FHIR Chat · Maven help needed · hapi

Stream: hapi

Topic: Maven help needed


view this post on Zulip Grahame Grieve (Aug 02 2019 at 12:28):

Does anyone here understand maven? The maven build for java core is failing because it can't get through the JUnit tests. For now, I just want to turn them off - it's ignoring their pass/fail anyway, so it's just wasting time and CPU

view this post on Zulip Grahame Grieve (Aug 02 2019 at 12:29):

but I can't figure out how to configure this - all the web doco refers to configuration options I can't find anyway.... so I don't know.....

view this post on Zulip Grahame Grieve (Aug 02 2019 at 12:31):

I have to say.... I hate Maven. What an awful thing

view this post on Zulip Patrick Werner (Aug 02 2019 at 12:46):

you just want to skip all tests?

view this post on Zulip Patrick Werner (Aug 02 2019 at 12:47):

commandline: -Dmaven.test.skip=true

view this post on Zulip Patrick Werner (Aug 02 2019 at 12:47):

or in the pom

<properties>
        <maven.test.skip>true</maven.test.skip>
    </properties>

view this post on Zulip Grahame Grieve (Aug 02 2019 at 12:49):

hah the pom - thanks

view this post on Zulip Grahame Grieve (Aug 02 2019 at 20:17):

ok now that got me over the hump, I have a more difficult question. I want to run some of the tests. Some of them, I care greatly about. But only some of them. The others, I don't want them to run, but I also don't want to delete them

view this post on Zulip Grahame Grieve (Aug 02 2019 at 20:17):

so.... https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html. Except that... there's no surefire plugin in the POM?

view this post on Zulip Patrick Werner (Aug 02 2019 at 20:39):

https://github.com/hapifhir/org.hl7.fhir.core/pull/68

view this post on Zulip Patrick Werner (Aug 02 2019 at 20:41):

oh no wait. Its not working.

view this post on Zulip Patrick Werner (Aug 02 2019 at 20:42):

there is a surefire at line 151

view this post on Zulip Patrick Werner (Aug 02 2019 at 20:51):

no its working, i excluded * for now and deleted the skip test property.
I also inserted a ver number for the jar plugin of the cli to get rid of a maven build warning.

view this post on Zulip Patrick Werner (Aug 03 2019 at 16:32):

@Grahame Grieve fixed it for you

view this post on Zulip Grahame Grieve (Aug 03 2019 at 21:01):

great thanks

view this post on Zulip Grahame Grieve (Aug 05 2019 at 04:51):

so a follow up on this - if I want to add JUnit tests to run, do I add them in the root POM, or in the project specific POM?

view this post on Zulip James Agnew (Aug 05 2019 at 19:04):

A fairly common approach to this kind of thing is to set up Maven Surefire plugin (the plugin that executes the tests) to only automatically run test classes called "FooTest". If you have old tests that you want to keep but not run, just rename them so that they don't end in Test.

..but why do you not just want to delete them? Is the intent to run them later?

view this post on Zulip Grahame Grieve (Aug 05 2019 at 21:21):

someone might want to invest the time to get them running again.

view this post on Zulip Grahame Grieve (Aug 05 2019 at 21:21):

just cause I don't care doesn't mean noone else does

view this post on Zulip Grahame Grieve (Aug 05 2019 at 21:22):

I can't actually get the tests to run ok - some mystifying maven dependency issue

view this post on Zulip Grahame Grieve (Aug 05 2019 at 21:22):

java.lang.NoSuchMethodError: ca.uhn.fhir.model.api.TemporalPrecisionEnum.stringLength()I
at org.hl7.fhir.r5.model.BaseDateTimeType.equalsUsingFhirPathRules(BaseDateTimeType.java:875)

view this post on Zulip Grahame Grieve (Aug 05 2019 at 21:23):

everything else is fine, just not the JUnit tests

view this post on Zulip Patrick Werner (Aug 05 2019 at 21:33):

i have a look now

view this post on Zulip Patrick Werner (Aug 05 2019 at 21:39):

i get a lot of file not found errors because it tries it loads from c:/work/something...

view this post on Zulip Grahame Grieve (Aug 05 2019 at 21:41):

use AllR5Tests

view this post on Zulip Grahame Grieve (Aug 05 2019 at 21:42):

that's my own path, but I don't see any direct reference to it from code run by AllR5Tests

view this post on Zulip Patrick Werner (Aug 05 2019 at 21:46):

i only have "not done yet" and "java.io.FileNotFoundException: C:\work\org.hl7.fhir\build\publish/timing.shex (No such file or directory)" errors

view this post on Zulip Patrick Werner (Aug 05 2019 at 21:47):

that's my own path, but I don't see any direct reference to it from code run by AllR5Tests

right :thinking: its only used in the release.bat files

view this post on Zulip Patrick Werner (Aug 05 2019 at 21:54):

doTest("C:\\work\\org.hl7.fhir\\build\\tests\\turtle\\empty_collection.ttl", true);

view this post on Zulip Patrick Werner (Aug 05 2019 at 21:54):

there are lots of file references like this in the tests

view this post on Zulip Patrick Werner (Aug 05 2019 at 21:55):

https://github.com/hapifhir/org.hl7.fhir.core/search?q=C%3A%5C%5Cwork%5C%5Corg.hl7.fhir%5C%5C&unscoped_q=C%3A%5C%5Cwork%5C%5Corg.hl7.fhir%5C%5C

view this post on Zulip Grahame Grieve (Aug 05 2019 at 22:06):

Only on in R5 tests. I'll commit

view this post on Zulip Patrick Werner (Sep 13 2019 at 16:09):

added PR: https://github.com/hapifhir/org.hl7.fhir.core/pull/77
now only the R5 and R5 Validation Testsuites are included.
I would prefer excludes over includes as we have to include every new TestSuite manually (e.g. R6 Testsuite), easiest would be to exclude alle pre R5 Tests, but even some of the R5 Tests are failing.
Should we get all R5 Tests running? Then we could switch to excludes.

view this post on Zulip Grahame Grieve (Sep 13 2019 at 16:27):

I'll sort out what's failing... but the suite includes most of them

view this post on Zulip Patrick Werner (Sep 13 2019 at 17:11):

i also did a exclude based solution:
https://github.com/hapifhir/org.hl7.fhir.core/pull/78
excludes all tests in dstu2 - r4 and the r3r4conversionTest

view this post on Zulip Grahame Grieve (Sep 14 2019 at 14:17):

hey @Patrick Werner I just did a mvn build that failed:

view this post on Zulip Grahame Grieve (Sep 14 2019 at 14:18):

[ERROR] Errors:
[ERROR]   CDARoundTripTests.setUp:29 »  Not done yet
[ERROR]   CDARoundTripTests.setUp:29 »  Not done yet
[ERROR]   CDARoundTripTests.setUp:29 »  Not done yet
[ERROR]   JsonDirectTests.test:31 » FileNotFound Source 'C:\work\org.hl7.fhir\build\publ...
[INFO]
[ERROR] Tests run: 2173, Failures: 0, Errors: 4, Skipped: 0

those tests shouldn't be running.... where is this configured?

view this post on Zulip Patrick Werner (Sep 14 2019 at 14:28):

oh. i have a look.

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:08):

fixed it. All Test include/excludes are defined in the root pom.
i now did it like this(as i didn't wanted to hardcode the Tests which shall run):

<includes>
  <include>**/All*</include>
</includes>
<excludes>
  <exclude>**/*dstu*/**</exclude>
  <exclude>**/*r4*/**</exclude>
</excludes>

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:08):

ok thanks. I'm trying ut now

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:12):

so all Testsuites (defined by containing All in their name) are run, excluding everything which contains dstu or r4

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:13):

they are still some build errors independent of the tests

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:14):

but I do think we want to hard code the tests which we want to run. SInce I regulalry run the tests from the IDE I want a single suite that includes all the running tests, and then you just nominate that to maven, and all contexts use the same set of tests

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:14):

though I'm not insisting it be done that way, just that I can easily run the same set of tests from eclipse as run when doing a maven release

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:14):

thanks

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:14):

I guess that comes to the same thing. I'll call myself happy then

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:14):

hmm. which ones fail for you? cause they're working for me, so if you tell me, I'll hunt them

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:15):

https://travis-ci.org/hapifhir/org.hl7.fhir.core/builds/584979400?utm_source=github_status&utm_medium=notification

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:15):

Build failure on R5

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:17):

hmm do build failures get pushed anywhere?

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:17):

(like to Zulip)?

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:23):

hmm. more maven build failures:

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:24):

are you somewhere around? Could join to fix them

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:24):

[ERROR] Errors:
[ERROR]   CDAValidationTestCase.test » OutOfMemory Java heap space
[ERROR]   ProfileComparisonTests.testCurrentComparison » OutOfMemory Java heap space
[ERROR]   ValidationEngineTests.test140 » OutOfMemory GC overhead limit exceeded
[ERROR]   ValidationEngineTests.test301 » OutOfMemory Java heap space
[ERROR]   ValidationEngineTests.test301USCore » OutOfMemory Java heap space
[ERROR]   ValidationEngineTests.testCurrentJson » OutOfMemory GC overhead limit exceeded
[ERROR]   ValidationEngineTests.testCurrentXml » OutOfMemory GC overhead limit exceeded
[ERROR]   ValidationTestSuite.test:116 » OutOfMemory Java heap space
[ERROR]   ValidationTestSuite.test[141: id Xml.slice-by-polymorphic-type.xml] » OutOfMemory
[ERROR]   ValidationTestSuite.test[144: id Xml.slicing-example-uk.xml] » OutOfMemory Jav...
[ERROR]   ValidationTestSuite.test[145: id Xml.slicing-types-by-string.xml] » OutOfMemory
[ERROR]   ValidationTestSuite.test[150: id Xml.valueset-slicing-meds-bad.xml] » OutOfMemory
[ERROR]   ValidationTestSuite.test[151: id Xml.valueset-slicing-meds.xml] » OutOfMemory ...
[ERROR]   ValidationTestSuite.test:118 » OutOfMemory Java heap space

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:24):

where is java heap space specified?

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:24):

I'm in M103 but I should probably come ind you

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:25):

I'm at table 14

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:26):

John Moerke pointed to this article yesterday:
http://www.messiahpsychoanalyst.org/wikihow/index.php/How_to_Increase_Java_Memory_in_Windows

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:27):

hmm do build failures get pushed anywhere?

not pushed, but viewable in github: https://github.com/hapifhir/org.hl7.fhir.core/commits/master

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:29):

there should be same way to specify this in maven

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:31):

maven runs in java, so its a hen egg problem

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:33):

right but mvn launches java...

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:34):

hate this part of java...

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:34):

https://subscription.packtpub.com/book/application_development/9781783983865/1/ch01lvl1sec10/configuring-the-heap-size

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:36):

@Joel Schneider just pointed me to the maven compiler plugin, which is a way to do it. Will do a PR.

view this post on Zulip Grahame Grieve (Sep 14 2019 at 15:48):

a problem with the mvn thing is that I'm doing a release of all the projects, and it completes the release one by one rather than compiling and running the tests on all projects before releasing any. I don't know if there's any way to fix that

view this post on Zulip Patrick Werner (Sep 14 2019 at 15:56):

Joel Schneider just pointed me to the maven compiler plugin, which is a way to do it. Will do a PR.

pushed and merged it

view this post on Zulip Patrick Werner (Sep 14 2019 at 16:15):

a problem with the mvn thing is that I'm doing a release of all the projects, and it completes the release one by one rather than compiling and running the tests on all projects before releasing any. I don't know if there's any way to fix that

i think that kind of problems could be solved by setting up a proper CI pipeline. Which would include git tags per release which then would trigger the release pipeline living in travis. Would propably save you a lot of manual work.
Happy to support you with that.

view this post on Zulip Grahame Grieve (Sep 15 2019 at 00:43):

nah James showed me the right parameter to maven. all good.

view this post on Zulip Grahame Grieve (Sep 15 2019 at 00:43):

I don't understand this test fail on travis:

[ERROR] equalsUsingFhirPathRulesOther(org.hl7.fhir.r5.model.BaseDateTimeTypeTest)  Time elapsed: 0.002 s  <<< ERROR!
java.lang.NullPointerException
    at org.hl7.fhir.r5.model.BaseDateTimeTypeTest.equalsUsingFhirPathRulesOther(BaseDateTimeTypeTest.java:55)

It works fine for me and I can't imagine how the code at that line can generate an NPE:

        assertFalse(compareDateTimes("1974-12-25", "1974-12-25T12:34:00-10:00"));

view this post on Zulip James Agnew (Sep 15 2019 at 02:04):

those two dates have different precision... i would expect the comparison to return null, no?

view this post on Zulip Grahame Grieve (Sep 15 2019 at 12:35):

all the tests are passing now ;-)


Last updated: Apr 12 2022 at 19:14 UTC