Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.0.0-alpha-1
-
None
-
None
-
JDK 9+181, OS X 10.12.6, Maven 3.5.0
Description
Hi,
am new to JDK 9 and attempting to migrate an existing JNI project of mine, https://sourceforge.net/projects/yad2xx/, to the new module format.
The current project is setup as a multi module project with separate submodules for the JAR, DLL and JNILIB targets. The project targets Win7/8/10 and OS X but I generally use OS X. The Java and native library are building ok.
The project has one compile/runtime dependency on Apache commons-cli. As far as I am aware there is currently no JDK 9 module for commons-cli. I have watched the video on JDK 9 Modular Development (https://blogs.oracle.com/java/modular-development) and as far as I can tell it should be relatively easy to make my code a module without requiring common-cli to also be a module.
According to the video (~30min mark) my module can use the 'Automatic Modules' feature and the JDK will infer a module from the commons-cli JAR. I am using following module-info.java file:
module net.sf.yad2xx { requires java.base; requires commons.cli; exports net.sf.yad2xx; }
The Maven compile phase succeeds with this warning:
[WARNING] ******************************************************************************************************************** [WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! * [WARNING] ********************************************************************************************************************
Unfortunately, the process fails at the package phase:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jmod-plugin:3.0.0-alpha-1:create (default-create) on project yad2xx: [ERROR] Exit code: 2 [ERROR] Command line was: /bin/sh -c /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/jmod @/Users/sjdavies/workspace_oxy1a/yad2xx/target/jmodCreateArgs
I suspect the contents of jmodCreateArgs is the problem:
create --module-version 1.1-SNAPSHOT --class-path /Users/sjdavies/workspace_oxy1a/yad2xx/target/classes:/Users/sjdavies/.m2/repository/commons-cli/commons-cli/1.4/commons-cli-1.4.jar --libs /Users/sjdavies/workspace_oxy1a/yad2xx/src/main/libs --module-path "/Users/sjdavies/workspace_oxy1a/yad2xx/target/classes:*/Users/sjdavies/.m2/repository/commons-cli/commons-cli/1.4/commons-cli-1.4.jar*:/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/jmods" /Users/sjdavies/workspace_oxy1a/yad2xx/target/jmods/yad2xx.jmod
Should the tool be putting the JAR file on the --module-path?