gnodet opened a new pull request, #403:
URL: https://github.com/apache/maven-archiver/pull/403

   Fixes https://github.com/apache/maven-jar-plugin/issues/596
   
   Port of #402 to master.
   
   Projects that configure `Automatic-Module-Name` in 
`<archive><manifestEntries>` using a property derived from the artifactId (e.g. 
`${project.groupId}.${project.artifactId}`) can produce invalid JPMS module 
names when the artifactId contains hyphens. This previously caused a hard build 
failure with `ManifestException: Invalid automatic module name`.
   
   This change sanitizes the invalid name using the same algorithm the JDK 
applies when deriving an automatic module name from a JAR file name 
(`ModulePath.cleanModuleName()`): non-alphanumeric characters are replaced with 
`.`, repeated dots are collapsed, and leading/trailing dots are stripped. A 
warning is emitted so the user is aware.
   
   For example, `org.apache.geronimo.arthur.integration-test` becomes 
`org.apache.geronimo.arthur.integration.test`.
   
   If the sanitized name is still not a valid Java module name (e.g. starts 
with a digit, contains a keyword), the attribute is omitted with a warning — it 
cannot be fixed automatically in that case.
   
   Changes:
   - `MavenArchiver.java`: Add `cleanModuleName()` sanitization method; replace 
hard failure with sanitize-then-warn for invalid module names; only omit the 
attribute when sanitization still yields an invalid name
   - `MavenArchiverTest.java`: Updated tests to verify sanitization behavior; 
added `cleanModuleNames` parameterized test for the sanitization algorithm


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to