Problem
maven-jar-plugin 3.4.2 validates the derived automatic module name (inferred from the artifact's Automatic-Module-Name manifest attribute or from the artifactId) even when it is not explicitly configured in the POM. If the derived name contains hyphens (which are not valid in Java module names), the build fails:
Error assembling JAR: Invalid automatic module name: 'org.apache.geronimo.arthur.integration-test'
This was not enforced in maven-jar-plugin 3.3.1. The stricter validation was introduced via maven-archiver in 3.4.2.
The check isValidModuleName() in maven-archiver's MavenArchiver now validates the derived module name, but many legitimate Apache projects have artifact IDs containing hyphens (e.g. integration-test, osgi-cdi) which produce invalid module names when derived mechanically. These projects do not intend to be JPMS modules and have no module-info.java.
Steps to reproduce
- Build a project whose artifactId (or
Automatic-Module-Name manifest entry) contains a hyphen, e.g. my-artifact-integration-test.
- Use
maven-jar-plugin 3.4.2.
- Build fails with
Error assembling JAR: Invalid automatic module name: '...'.
Expected behavior
One of:
- Only validate explicitly declared names: If
Automatic-Module-Name is not set explicitly in the POM's <archive><manifestEntries>, do not fail — the derived name is merely informational for unnamed modules and does not need to be a valid JPMS module name.
- Warn instead of fail: Emit a warning so the project is aware of the problem without breaking the build.
Affected versions
- 3.4.2 (regression vs 3.3.1)
Context
Found while running Maven 4 compatibility tests across Apache projects. Affected projects include:
geronimo-arthur — derived name org.apache.geronimo.arthur.integration-test
incubator-kie-kogito-benchmarks — empty derived name
karaf-winegrower — derived name org.apache.winegrower.cepages.winegrower-cepage-osgi-cdi
None of these projects declare module-info.java or intend to be named JPMS modules.
Problem
maven-jar-plugin3.4.2 validates the derived automatic module name (inferred from the artifact'sAutomatic-Module-Namemanifest attribute or from the artifactId) even when it is not explicitly configured in the POM. If the derived name contains hyphens (which are not valid in Java module names), the build fails:This was not enforced in
maven-jar-plugin3.3.1. The stricter validation was introduced viamaven-archiverin 3.4.2.The check
isValidModuleName()inmaven-archiver'sMavenArchivernow validates the derived module name, but many legitimate Apache projects have artifact IDs containing hyphens (e.g.integration-test,osgi-cdi) which produce invalid module names when derived mechanically. These projects do not intend to be JPMS modules and have nomodule-info.java.Steps to reproduce
Automatic-Module-Namemanifest entry) contains a hyphen, e.g.my-artifact-integration-test.maven-jar-plugin3.4.2.Error assembling JAR: Invalid automatic module name: '...'.Expected behavior
One of:
Automatic-Module-Nameis not set explicitly in the POM's<archive><manifestEntries>, do not fail — the derived name is merely informational for unnamed modules and does not need to be a valid JPMS module name.Affected versions
Context
Found while running Maven 4 compatibility tests across Apache projects. Affected projects include:
geronimo-arthur— derived nameorg.apache.geronimo.arthur.integration-testincubator-kie-kogito-benchmarks— empty derived namekaraf-winegrower— derived nameorg.apache.winegrower.cepages.winegrower-cepage-osgi-cdiNone of these projects declare
module-info.javaor intend to be named JPMS modules.