New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit JAXB dependencies in the junit-runner so it works in Java 9+ without --add-modules=java.xml.bind #5667

Merged
merged 1 commit into from Apr 6, 2018

Conversation

Projects
None yet
3 participants
@cheister
Copy link
Contributor

cheister commented Apr 5, 2018

Problem

In Java 9 and 10 they have removed default access for the JAXB classes from the JDK. In order to use them you need to add --add-modules=java.xml.bind to the java invocation of the junit-testrunner

Solution

Add explicit dependencies for the JAXB jars

Result

The junit-testrunner can run under Java 9 and Java 10 with no additional command line flags.

Chris Heisterkamp
Add explicit JAXB dependencies in the junit-runner so it works in Jav…
…a 9+ without --add-modules=java.xml.bind

@cheister cheister requested a review from stuhood Apr 5, 2018

@stuhood

stuhood approved these changes Apr 5, 2018

Copy link
Member

stuhood left a comment

Thanks!

@cheister

This comment has been minimized.

Copy link
Contributor

cheister commented Apr 5, 2018

Currently there isn't an easy way to test this in the repo. I tested it locally by taking the command line run of ./pants test tests/java/org/pantsbuild/tools/junit/impl:: and running it with Java 10. e.g.

/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/bin/java -Djava.awt.headless=true -Xmx1g -cp .pants.d/test/junit/_runs/a9b6d1ed13e58e51d8c688819c4d71bdc217545a/combined/all/tmpHSV_yO.jar org.pantsbuild.tools.junit.ConsoleRunner -output-mode=NONE -outdir .pants.d/test/junit/_runs/36e822844a9951f9dc81d9bafc3c61131b388c98 -default-concurrency SERIAL -parallel-threads 0 -xmlreport org.pantsbuild.tools.junit.impl.ConsoleRunnerImplTest  org.pantsbuild.tools.junit.impl.ConsoleRunnerTest org.pantsbuild.tools.junit.impl.SpecParserTest org.pantsbuild.tools.junit.impl.SpecSetTest org.pantsbuild.tools.junit.impl.SpecTest org.pantsbuild.tools.junit.impl.TestMethodTest org.pantsbuild.tools.junit.impl.UtilTest org.pantsbuild.tools.junit.impl.XmlReportTest
@baroquebobcat

This comment has been minimized.

Copy link
Contributor

baroquebobcat commented Apr 5, 2018

Did you try updating the platform info for java for pants to 10? Pants may be able to run tests with 10, but it looks like, right now, we only have declarations for 6-8 https://github.com/pantsbuild/pants/blob/master/pants.ini#L279-L285

@cheister

This comment has been minimized.

Copy link
Contributor

cheister commented Apr 5, 2018

Currently zinc doesn't run with Java9 or Java10 so we can't update the platform info.

@baroquebobcat

This comment has been minimized.

Copy link
Contributor

baroquebobcat commented Apr 5, 2018

Oh I see.

@cheister cheister merged commit 766bffa into pantsbuild:master Apr 6, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@cheister cheister deleted the cheister:junit-runner-java.xml.bind-dependencies branch Apr 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment