You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/12/12 01:14:00 UTC

[jira] [Commented] (MJMOD-20) Main class is not being set by maven-jmod-plugin

    [ https://issues.apache.org/jira/browse/MJMOD-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16718322#comment-16718322 ] 

ASF GitHub Bot commented on MJMOD-20:
-------------------------------------

andretadeu opened a new pull request #1: [MJMOD-20] set jmod --main-class argument if it is set.
URL: https://github.com/apache/maven-jmod-plugin/pull/1
 
 
   Hi!
   
   This pull request sets the parameter --main-class if it was set in:
   
   ```
   <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-jmod-plugin</artifactId>
                   <configuration>
                       <mainClass>com.andretadeu.greetings.Main</mainClass>
                       <modulePath>target/jmods</modulePath>
                       <moduleVersion>${project.version}</moduleVersion>
                   </configuration>
   ...
   </plugin>
   ```
   
   otherwise, if I am not able to set, I may not run jmod in modules that contains a Main class.
   
   Thanks,
   
   André Tadeu de Carvalho

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Main class is not being set by maven-jmod-plugin
> ------------------------------------------------
>
>                 Key: MJMOD-20
>                 URL: https://issues.apache.org/jira/browse/MJMOD-20
>             Project: Maven JMod Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.0-alpha-2
>         Environment: Ubuntu Linux 18.04 LTS
> Java 11.0.1 OpenJDK
> Maven 3.6.0
>            Reporter: Andre Tadeu de Carvalho
>            Priority: Major
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Hi!,
> I have created a project in and [https://github.com/andretadeu/maven-jigsaw-examples/tree/master/multi-modules-jmod-jlink|multi-modules-jmod-jlink] and I needed to set the parameter *--main-class* in _jmod create_ command.
> Trying to add the <mainClass> tag:
>  
> {code:java}
> <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-jmod-plugin</artifactId>
>     <configuration>
>         <mainClass>com.andretadeu.greetings.Main</mainClass> <!-- This-->
>         <modulePath>target/jmods</modulePath>
>         <moduleVersion>${project.version}</moduleVersion>
>     </configuration>
> {code}
>  
> Maven gave the following error during the execution of *maven-jlink-plugin*:
> [ERROR] 
> [ERROR] com.andretadeu.greetings file:///home/andre/workspaces/oss/maven-jigsaw-examples/multi-modules-jmod-jlink/greetings/target/jmods/com.andretadeu.greetings.jmod
> [ERROR] com.andretadeu.world file:///home/andre/workspaces/oss/maven-jigsaw-examples/multi-modules-jmod-jlink/world/target/jmods/com.andretadeu.world.jmod
> [ERROR] java.base file:///home/andre/.sdkman/candidates/java/11.0.1-open/jmods/java.base.jmod
> [ERROR] 
> [ERROR] Providers:
> [ERROR] java.base provides java.nio.file.spi.FileSystemProvider used by java.base
> [ERROR] Error: java.lang.IllegalArgumentException: com.andretadeu.greetings doesn't contain main class & main not specified in command line
> [INFO] ------------------------------------------------------------------------
> [INFO] Reactor Summary for multi-modules-jmod-jlink 1.0-SNAPSHOT:
> [INFO] 
> [INFO] multi-modules-jmod-jlink ........................... SUCCESS [ 0.185 s]
> [INFO] com.andretadeu.world ............................... SUCCESS [ 3.974 s]
> [INFO] com.andretadeu.greetings ........................... SUCCESS [ 0.628 s]
> [INFO] greetings-jlink .................................... FAILURE [ 3.068 s]
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 8.916 s
> [INFO] Finished at: 2018-12-11T22:42:31-02:00
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jlink-plugin:3.0.0-alpha-2-SNAPSHOT:jlink (default-jlink) on project greetings-jlink: 
> [ERROR] Exit code: 1
> [ERROR] Command line was: /bin/sh -c /home/andre/.sdkman/candidates/java/11.0.1-open/bin/jlink @/home/andre/workspaces/oss/maven-jigsaw-examples/multi-modules-jmod-jlink/greetings-jlink/target/jlinkArgs
> [ERROR] 
> [ERROR] 
> [ERROR] -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-jlink-plugin:3.0.0-alpha-2-SNAPSHOT:jlink (default-jlink) on project greetings-jlink: 
> Exit code: 1
> Command line was: /bin/sh -c /home/andre/.sdkman/candidates/java/11.0.1-open/bin/jlink @/home/andre/workspaces/oss/maven-jigsaw-examples/multi-modules-jmod-jlink/greetings-jlink/target/jlinkArgs
>  
> I noticed that the *--main-class* parameter was not set in **_jmodCreateArgs_:
> {code:java}
> create
> --module-version
> 1.0-SNAPSHOT
> --class-path
> /home/andre/workspaces/oss/maven-jigsaw-examples/multi-modules-jmod-jlink/greetings/target/classes
> --module-path
> "/home/andre/workspaces/oss/maven-jigsaw-examples/multi-modules-jmod-jlink/greetings/target/classes:/home/andre/.sdkman/candidates/java/11.0.1-open/jmods"
> /home/andre/workspaces/oss/maven-jigsaw-examples/multi-modules-jmod-jlink/greetings/target/jmods/com.andretadeu.greetings.jmod
> {code}
> Debugging the plugin, I have found the root cause of the problem and I will make a pull request after publishing this issue.
>  
> Thanks,
>  
> André Tadeu de Carvalho
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)