[Created] (MJMOD-7) Packaging fails when 'Automatic Modules' exist.

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Created] (MJMOD-7) Packaging fails when 'Automatic Modules' exist.

JIRA jira@apache.org
Stephen Davies created MJMOD-7:

             Summary: Packaging fails when 'Automatic Modules' exist.
                 Key: MJMOD-7
                 URL: https://issues.apache.org/jira/browse/MJMOD-7
             Project: Maven JMod Plugin
          Issue Type: Bug
    Affects Versions: 3.0.0-alpha-1
         Environment: JDK 9+181, OS X 10.12.6, Maven 3.5.0

            Reporter: Stephen Davies

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:

Should the tool be putting the JAR file on the --module-path?

This message was sent by Atlassian JIRA