Experimental JDK9 module-info support#124
Experimental JDK9 module-info support#124jstuyts merged 3 commits intoargparse4j:masterfrom concision:feat/jdk9-support
Conversation
|
Since this pull request makes the change that JDK9+ is required for compiling the project, I suspect that the functionality from #95 "Ensure compatibility with Java 1.6 and 1.7 when running Maven using 1.8" can be replaced using JDK9+'s new |
|
Thanks for the tip about the |
|
I am willing to author another PR to make use of the |
|
After some talking with a developer on a another pull request of mine to integrate module support (see |
|
A multi-release JAR is not necessary in this case as only 1 additional class file that won't break older JDKs is needed. But I am not against an MRJAR if this makes the Maven POM a lot cleaner. I suggested to change the build in a separate issue earlier, but as this PR changes the build significantly anyway I don't mind if you change it to an MRJAR in this PR if it simplifies things a lot. And about the version number: The changes you have made are backwards compatible, so only a revision increase would be sufficient. The head is currently at 0.9.0-SNAPSHOT which is a higher minor version than the last release. These changes could also be done in 0.8.2. |
|
I do not think a MRJAR would simplify the Maven POM (quite the opposite) - I will leave it out. To be clear - should I be changing the version number (to Is there anything that needs to be changed in this pull request before potentially merging? |
|
Leave the version number as is. I will change it what I think is appropriate before a release. The new compilation using I already reviewed your changes, and build it locally. It is looking great, but I want to have 1 more careful look before I merge. I expect that I can merge within the next couple of days. |
…va` to improve build duration.
This pull request resolves issue #123 "JDK 9+ Compatability with Project Jigsaw & module-info.class" by adding a Java 9 compilation phase in all modules and upgrading Travis CI to
openjdk9.Maven module changes:
argparse4j-root:jdk.6.rt.jar.pathandjdk.7.rt.jar.path, as JDK9+ no longer has art.jarfile; values must now be explicitly passed as Maven CLI properties (e.g.-Djdk.6.rt.jar.path=...) or passed through the environment variablesJAVA6_HOMEandJAVA7_HOME-DskipJdkPathValidation=trueJAVA_HOME, otherwise the build failsorg.apache.maven.plugins:maven-compiler-pluginfrom3.6.2to3.8.1for better Java 9 supportcom.github.siom79.japicmp:japicmp-maven-pluginfrom0.10.0to0.14.3to resolve a class level error (i.e. older plugin did not support Java 9 bytecode)argparse4j,argparse4j-java7,argparse4j-hadoop(grouped for brevity):jdk9-module-compilethat compiles all classes to Java 9 (includingmodule-info.java); this is used to generate and validate the module-info class.default-compilecompilation phase tojdk6-compilethat compiles all classes to Java 6 (or Java 7, in the case ofargparse4j-java7), overwriting the Java 9 classes (excludingmodule-info.class)default-testCompiletest compilation phase to Java 6 (or Java 7, in the case ofargparse4j-java7)module-info.javathat exposes all packages publicly, with the following module names:argparse4jmodule name:net.sourceforge.argparse4jargparse4j-java7module name:net.sourceforge.argparse4j.ext.java7argparse4j-hadoopmodule name:net.sourceforge.argparse4j.ext.hadoopargparse4j-hadoop:jdk.tools:jdk.toolsfromorg.apache.hadoop:hadoop-commondue to it causing a dependency resolution errorCaveats:
argparse4j-hadoopmodule requires the Maven dependencyorg.apache.hadoop:hadoop-common, which does not have a Java 9module-info.classTravis CI Changes:
installstage, as this was effectively building the project twice (and not just downloading plugins/dependencies)installstage-Djdk.6.rt.jar.path=...and-Djdk.7.rt.jar.path=...arguments during thescriptstage, as they are now inferred fromJAVA6_HOMEandJAVA7_HOME@jstuyts I think these changes are ready for feedback. Projects with Java 9 module support that have a
requires argparse4jwill need to migrate torequires net.sourceforge.argparse4j. I have granted permission for project maintainers to update my source branchfeat/jdk9-support. I imagine the semver version needs to be updated to reflect these changes.As an aside, this took significantly longer than I expected due to various strange Maven interactions.
Thanks in advance.