Stream: hapi
Topic: Maven help needed
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
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.....
Grahame Grieve (Aug 02 2019 at 12:31):
I have to say.... I hate Maven. What an awful thing
Patrick Werner (Aug 02 2019 at 12:46):
you just want to skip all tests?
Patrick Werner (Aug 02 2019 at 12:47):
commandline: -Dmaven.test.skip=true
Patrick Werner (Aug 02 2019 at 12:47):
or in the pom
<properties> <maven.test.skip>true</maven.test.skip> </properties>
Grahame Grieve (Aug 02 2019 at 12:49):
hah the pom - thanks
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
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?
Patrick Werner (Aug 02 2019 at 20:39):
https://github.com/hapifhir/org.hl7.fhir.core/pull/68
Patrick Werner (Aug 02 2019 at 20:41):
oh no wait. Its not working.
Patrick Werner (Aug 02 2019 at 20:42):
there is a surefire at line 151
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.
Patrick Werner (Aug 03 2019 at 16:32):
@Grahame Grieve fixed it for you
Grahame Grieve (Aug 03 2019 at 21:01):
great thanks
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?
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?
Grahame Grieve (Aug 05 2019 at 21:21):
someone might want to invest the time to get them running again.
Grahame Grieve (Aug 05 2019 at 21:21):
just cause I don't care doesn't mean noone else does
Grahame Grieve (Aug 05 2019 at 21:22):
I can't actually get the tests to run ok - some mystifying maven dependency issue
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)
Grahame Grieve (Aug 05 2019 at 21:23):
everything else is fine, just not the JUnit tests
Patrick Werner (Aug 05 2019 at 21:33):
i have a look now
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...
Grahame Grieve (Aug 05 2019 at 21:41):
use AllR5Tests
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
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
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
Patrick Werner (Aug 05 2019 at 21:54):
doTest("C:\\work\\org.hl7.fhir\\build\\tests\\turtle\\empty_collection.ttl", true);
Patrick Werner (Aug 05 2019 at 21:54):
there are lots of file references like this in the tests
Patrick Werner (Aug 05 2019 at 21:55):
Grahame Grieve (Aug 05 2019 at 22:06):
Only on in R5 tests. I'll commit
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.
Grahame Grieve (Sep 13 2019 at 16:27):
I'll sort out what's failing... but the suite includes most of them
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
Grahame Grieve (Sep 14 2019 at 14:17):
hey @Patrick Werner I just did a mvn build that failed:
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?
Patrick Werner (Sep 14 2019 at 14:28):
oh. i have a look.
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>
Grahame Grieve (Sep 14 2019 at 15:08):
ok thanks. I'm trying ut now
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
Patrick Werner (Sep 14 2019 at 15:13):
they are still some build errors independent of the tests
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
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
Grahame Grieve (Sep 14 2019 at 15:14):
thanks
Grahame Grieve (Sep 14 2019 at 15:14):
I guess that comes to the same thing. I'll call myself happy then
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
Patrick Werner (Sep 14 2019 at 15:15):
Patrick Werner (Sep 14 2019 at 15:15):
Build failure on R5
Grahame Grieve (Sep 14 2019 at 15:17):
hmm do build failures get pushed anywhere?
Grahame Grieve (Sep 14 2019 at 15:17):
(like to Zulip)?
Grahame Grieve (Sep 14 2019 at 15:23):
hmm. more maven build failures:
Patrick Werner (Sep 14 2019 at 15:24):
are you somewhere around? Could join to fix them
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
Grahame Grieve (Sep 14 2019 at 15:24):
where is java heap space specified?
Grahame Grieve (Sep 14 2019 at 15:24):
I'm in M103 but I should probably come ind you
Patrick Werner (Sep 14 2019 at 15:25):
I'm at table 14
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
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
Grahame Grieve (Sep 14 2019 at 15:29):
there should be same way to specify this in maven
Patrick Werner (Sep 14 2019 at 15:31):
maven runs in java, so its a hen egg problem
Grahame Grieve (Sep 14 2019 at 15:33):
right but mvn launches java...
Grahame Grieve (Sep 14 2019 at 15:34):
hate this part of java...
Grahame Grieve (Sep 14 2019 at 15:34):
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.
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
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
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.
Grahame Grieve (Sep 15 2019 at 00:43):
nah James showed me the right parameter to maven. all good.
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"));
James Agnew (Sep 15 2019 at 02:04):
those two dates have different precision... i would expect the comparison to return null, no?
Grahame Grieve (Sep 15 2019 at 12:35):
all the tests are passing now ;-)
Last updated: Apr 12 2022 at 19:14 UTC