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-260) Warn about invalid 'Automatic-Module-Name' in MANIFEST
Date Fri, 16 Nov 2018 18:56:00 GMT

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

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

khmarbaise commented on a change in pull request #3: [MJAR-260] Fail on invalid automatic
module name
URL: https://github.com/apache/maven-jar-plugin/pull/3#discussion_r234312461
 
 

 ##########
 File path: src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
 ##########
 @@ -223,6 +226,18 @@ public File createArchive()
 
             archiver.createArchive( session, project, archive );
 
+            JarFile javaUtilJarFile = new JarFile( jarFile );
 
 Review comment:
   This will result in a resource leak cause javaUtilJarFile is never closed....and doesn't
it need to reread the file(I'm ot sure about)? 
   What about reusing the archive configuration part like this and do the check before we
create the real archive? (If I correctly seen that would result in changing the IT as well)...
   ```java
               if ( archive.getManifestEntries().containsKey( AUTOMATIC_MODULE_NAME ) )
               {
                   String automaticModuleName = archive.getManifestEntries().get( AUTOMATIC_MODULE_NAME
);
                   if ( automaticModuleName != null )
                   {
                       if ( !isValidModuleName( automaticModuleName ) )
                       {
                           throw new MojoExecutionException( "Invalid automatic module name:
'" + automaticModuleName
                               + "'" );
                       }
                   }
               }
   
               archiver.createArchive( session, project, archive );
   ```
   What do you think?
   
   Furthermore we might keep that in maven-jar-plugin in the first step and improve maven-archiver
to make this check easier ? Or move that into maven-archiver (could be done in createArchive()
method ) which means can be reused by other plugins as well...or even better will be checked
already there...

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


> Warn about invalid 'Automatic-Module-Name' in MANIFEST
> ------------------------------------------------------
>
>                 Key: MJAR-260
>                 URL: https://issues.apache.org/jira/browse/MJAR-260
>             Project: Maven JAR Plugin
>          Issue Type: Improvement
>            Reporter: Christian Stein
>            Assignee: Christian Stein
>            Priority: Minor
>
> The Maven JAR Plugin should warn or even fail when an invalid name is detected within
the `META-INF/MANIFEST.MF` file.
> For details see https://sormuras.github.io/blog/2018-11-16-invalid-automatic-module-names



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

Mime
View raw message