maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andre Tadeu de Carvalho (JIRA)" <>
Subject [jira] [Commented] (MJMOD-7) Packaging fails when 'Automatic Modules' exist.
Date Fri, 22 Feb 2019 20:39:00 GMT


Andre Tadeu de Carvalho commented on MJMOD-7:

Hi [~sjdavies]!


>From my point of view, generating *JMOD* modules from projects that requires auto-module
libraries are not useful because these *JMOD* files would not be able to be used to generate
a slim version of the JVM. JLink complains when the users add auto-module JAR libraries in
the command's module-path, which is required by the module you are creating.

In my view, it is not prudent nor correct to put all the auto-module JARs in module-path.


Sorry for the feedback,

> Packaging fails when 'Automatic Modules' exist.
> -----------------------------------------------
>                 Key: MJMOD-7
>                 URL:
>             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,,
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 ( 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
> {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
> {noformat}
> I suspect the contents of jmodCreateArgs is the problem:
> {noformat}
> create
> --module-version
> --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

View raw message