maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MJAR-238) Allow setting of module main class
Date Mon, 01 Oct 2018 17:37:00 GMT

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

ASF GitHub Bot commented on MJAR-238:
-------------------------------------

plamentotev commented on a change in pull request #2: [MJAR-238] Allow setting of module main
class
URL: https://github.com/apache/maven-jar-plugin/pull/2#discussion_r221694289
 
 

 ##########
 File path: src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
 ##########
 @@ -76,7 +76,7 @@
     /**
      * The Jar archiver.
      */
-    @Component( role = Archiver.class, hint = "jar" )
+    @Component( role = Archiver.class, hint = "mjar" )
 
 Review comment:
   The thing is how to know if the JAR file is going to contain `module-info.class` or not?
The inclusion of the content is delegated to Maven Archiver:
   ```java
   archiver.getArchiver().addDirectory( contentDirectory, getIncludes(), getExcludes() );
   ```
   And in general the idea of `ModularJarArchiver` is to be safe to be used for "regular"
JAR files as well. You can think for it as an `JarArchiver` that can handle modules if needed.
The old `JarArchiver` could be used where you want to treat JAR strictly as archive - such
as source JAR or if you explicitly want the module descriptor to be left unmodified (but is
there such use case for the JAR plugin?)
   
   That being said I agree that would be better if we know in advance if we need `ModularJarArchiver`
or `JarArchiver` based on the existance of module descriptor (at very least will make the
code intention more explicit and easy to read), so if there some acceptable way to know that
I'll modify the PR.

----------------------------------------------------------------
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


> Allow setting of module main class
> ----------------------------------
>
>                 Key: MJAR-238
>                 URL: https://issues.apache.org/jira/browse/MJAR-238
>             Project: Maven JAR Plugin
>          Issue Type: Improvement
>         Environment: Java9 build 9+176, MacOS
>            Reporter: Machiel Groeneveld
>            Assignee: Robert Scholte
>            Priority: Minor
>
> When a Java9 module is created using the maven-jar plugin, setting the manifest/mainclass
does not set the module main class. Therefore the module is not executable without specifying
the main class. Executing the module using java -m domain.app gives the following error:
> _module jigsaw.app does not have a MainClass attribute_
> According to the module specification a module (jar) can have a main class set. If I
understand correctly it's inside the module-info.class as a property called ModuleMainClass
> When using the JDK9 jar command it will update the jar and the module-info.class.
> {noformat}
>   -e, --main-class=CLASSNAME The application entry point for stand-alone
>                              applications bundled into a modular, or executable,
>                              jar archive
> {noformat}
> I guess it would make sense to have this as a separate configuration item since the mainclass
entry in the manifest file is not needed in 'module mode' and vice versa.
> If this is a duplicate of another issue, please close this one, I couldn't find any existing
issues related to this.



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

Mime
View raw message