You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2019/01/19 15:47:00 UTC
[jira] [Updated] (MJMOD-7) Packaging fails when 'Automatic Modules'
exist.
[ https://issues.apache.org/jira/browse/MJMOD-7?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Scholte updated MJMOD-7:
-------------------------------
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:
{code}
module net.sf.yad2xx {
requires java.base;
requires commons.cli;
exports net.sf.yad2xx;
}
{code}
The Maven compile phase succeeds with this warning:
{noformat}
[WARNING] ********************************************************************************************************************
[WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *
[WARNING] ********************************************************************************************************************
{noformat}
Unfortunately, the process fails at the package phase:
{noformat}
[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
{noformat}
I suspect the contents of jmodCreateArgs is the problem:
{noformat}
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
{noformat}
Should the tool be putting the JAR file on the --module-path?
was:
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?
> 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
> Priority: Major
>
> 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:
> {code}
> module net.sf.yad2xx {
> requires java.base;
> requires commons.cli;
> exports net.sf.yad2xx;
> }
> {code}
> The Maven compile phase succeeds with this warning:
> {noformat}
> [WARNING] ********************************************************************************************************************
> [WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *
> [WARNING] ********************************************************************************************************************
> {noformat}
> Unfortunately, the process fails at the package phase:
> {noformat}
> [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
> {noformat}
> I suspect the contents of jmodCreateArgs is the problem:
> {noformat}
> 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
> {noformat}
> Should the tool be putting the JAR file on the --module-path?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)