# Failed to build Address Hierarchy module

**URL:** <https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265>\
**Category:** Development\
**Created:** [February 22, 2018, 6:28am UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265 "2018-02-22T06:28:35Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 6:28am UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/1 "2018-02-22T06:28:35Z")

</div>

Hi devs 🙂  
I’m currently working on [this(Use Daemon to authenticate task)](https://issues.openmrs.org/browse/ADDR-62) issue but I have failed to build a freshly cloned Address Hierarchy module . It fails with some tests failures without any code modification of commit ☹  
Full error log is [here](https://dpaste.de/XJMm)  
cc. @dkayiwa etc…  
Please look into this, tell me why the build fails 🙂

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 8:50am UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/2 "2018-02-22T08:50:41Z")

</div>

@mksd have glanced at this 🙂

---

<div class="post-metadata">

**Author:** ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)\
**Post date:** [February 22, 2018, 8:59am UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/3 "2018-02-22T08:59:56Z")

</div>

I can’t reproduce this though. Also clearly both Travis CI and the (OpenMRS) CI did pass on this, obviously.

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 9:04am UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/4 "2018-02-22T09:04:12Z")

</div>

Thanks for looking into this. But I still wonder what the problem could be. Any work arounds advise on troubleshooting this?

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 9:08am UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/5 "2018-02-22T09:08:27Z")

</div>

I have also tried to make sure my local master is equal to remote I just ran

> git fetch upstream  
> git reset --hard upstream/master

But this still fails out on tests ☹

---

<div class="post-metadata">

**Author:** ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)\
**Post date:** [February 22, 2018, 9:27am UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/6 "2018-02-22T09:27:57Z")

</div>

Would you have got access by any chance to another system to try this out? I know it’s a weird request, but there’s been issues with interfering tests with Spring Testing in AH at some point. Long story short it could happen that the problem you experience is very specific to the order in which tests are being fired by Maven, (and this is environment dependent).

I hope that’s not the problem, but just to rule this out you know…

---

<div class="post-metadata">

**Author:** ![mogoodrich](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mogoodrich/32/3324_2.png) [@mogoodrich](https://talk.openmrs.org/u/mogoodrich)\
**Post date:** [February 22, 2018, 2:52pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/7 "2018-02-22T14:52:59Z")

</div>

Ugh if it’s the problem with the tests running in a different order… I think I ran into something similar than this in the REST web services module yesterday.

Another way to test that would be to try to run a mvn build but restricting the tests to the tests that are failing (I think you do that by adding something like -Dtests=“testname”, but I don’t remember 100%). If it still fails in that case, it doesn’t necessarily mean that it isn’t an order problem (because the problem might be that some other test needs to run first), but if they pass it means the order likely is the problem.

I wonder if there’s a way to control the order that maven tests run in? I know this would be bad practice, but if we don’t get around to figuring out why order matters, it would be better than nothing.

Taker care, Mark

---

<div class="post-metadata">

**Author:** ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)\
**Post date:** [February 22, 2018, 3:00pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/8 "2018-02-22T15:00:58Z")

</div>

To run a single test (example with `AddressHierarchyServiceTest`):

```shell
mvn test -Dtest=
AddressHierarchyServiceTest -pl api/

```

> [@mogoodrich](#):
>
> I wonder if there’s a way to control the order that maven tests run in?

I had looked into that when I started bumping onto such issues and the short answer was definitely no. This randomness is kind of built-in to precisely enforce the independence of unit tests.

I suspect that this only occurs with Spring Testing, and there might be limited support in the framework for ensuring that context-sensitive tests are totally independent from each other. I definitely came across threads on SO where people faced such problems (and we did face them in AH as well). Not straightforward and time consuming 👎

---

<div class="post-metadata">

**Author:** ![mogoodrich](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mogoodrich/32/3324_2.png) [@mogoodrich](https://talk.openmrs.org/u/mogoodrich)\
**Post date:** [February 22, 2018, 3:37pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/9 "2018-02-22T15:37:48Z")

</div>

Yeah, I figured that was the case re: controlling the order of tests because I know I must have looked into it before… was hoping maybe that ability had been added since I last checked, or someone had a solution to do it I hadn’t though of… 🙂

Take care, Mark

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 6:18pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/10 "2018-02-22T18:18:34Z")

</div>

Thanks for precisely looking into this and getting concerned @mogoodrich but running a single maven test on the failing class fails with this [log](https://pastebin.com/1p4aGbn8) 🙂

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 6:20pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/11 "2018-02-22T18:20:07Z")

</div>

I have currently failed accessing another machine today ☹  
But will try out tomorrow 🙂

---

<div class="post-metadata">

**Author:** ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)\
**Post date:** [February 22, 2018, 6:22pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/12 "2018-02-22T18:22:13Z")

</div>

A Dockerised shell with Maven installed should do the trick though. That’s good opportunity to play around with Docker.

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 6:24pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/13 "2018-02-22T18:24:38Z")

</div>

Thanks for the idea, but any resources about " Dockerised shell with Maven" sounds new to me 😄

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [February 22, 2018, 6:26pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/14 "2018-02-22T18:26:46Z")

</div>

@samuel34 what does this return? mvn -v

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 6:29pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/15 "2018-02-22T18:29:39Z")

</div>

> $ mvn -v  
> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)  
> Maven home: C:\Program Files\apache-maven-3.3.9  
> Java version: 1.8.0\_121, vendor: Oracle Corporation  
> Java home: C:\Program Files\Java\jdk1.8.0\_121\jre  
> Default locale: en\_US, platform encoding: Cp1252  
> OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “dos”

cc: @dkayiwa

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [February 22, 2018, 6:35pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/16 "2018-02-22T18:35:04Z")

</div>

@samuel34 does it make any difference if you upgrade to the latest Java 1.8.x?

---

<div class="post-metadata">

**Author:** ![samuel34](https://talk.openmrs.org/user_avatar/talk.openmrs.org/samuel34/32/17813_2.png) [@samuel34](https://talk.openmrs.org/u/samuel34)\
**Post date:** [February 22, 2018, 6:38pm UTC](https://talk.openmrs.org/t/failed-to-build-address-hierarchy-module/16265/17 "2018-02-22T18:38:39Z")

</div>

Ooohh am gonna upgrade to the latest version never know it may be the root cause 🙄
