Problem
When mvnup upgrades maven-jar-plugin to 3.5.0, projects with hyphenated artifactId values get build failures:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.5.0:jar (default-jar)
on project integration-test: Error assembling JAR:
Invalid automatic module name: 'org.apache.geronimo.arthur.integration-test'
The jar-plugin 3.5.0 auto-generates Automatic-Module-Name from groupId + "." + artifactId. When the artifactId contains hyphens (e.g. integration-test, no-cxf, winegrower-cepage-osgi-cdi), the resulting module name is invalid because Java module identifiers cannot contain hyphens.
Affected projects (4)
| Project |
artifactId |
Generated module name |
| geronimo-arthur |
integration-test |
org.apache.geronimo.arthur.integration-test |
| karaf-winegrower |
winegrower-cepage-osgi-cdi |
...winegrower-cepage-osgi-cdi |
| openwebbeans-meecrowave |
no-cxf |
...no-cxf |
| atlas |
(jar tool exit 1) |
Similar hyphen issue |
Possible fixes
Option A (mvnup): When upgrading jar-plugin to 3.5.0, check if any module in the project has a hyphenated artifactId without an explicit Automatic-Module-Name manifest entry. If so, either:
- Skip the jar-plugin upgrade for that project
- Add an
Automatic-Module-Name with hyphens replaced by dots/underscores
Option B (jar-plugin): The jar-plugin itself could sanitize the auto-generated module name (e.g. replace hyphens with dots), or skip auto-generation when the result would be invalid, instead of failing the build.
Context
Data from maven4-testing run #13307 testing maven-4.0.x against all Apache projects.
Problem
When
mvnupupgradesmaven-jar-pluginto 3.5.0, projects with hyphenatedartifactIdvalues get build failures:The jar-plugin 3.5.0 auto-generates
Automatic-Module-NamefromgroupId + "." + artifactId. When the artifactId contains hyphens (e.g.integration-test,no-cxf,winegrower-cepage-osgi-cdi), the resulting module name is invalid because Java module identifiers cannot contain hyphens.Affected projects (4)
integration-testorg.apache.geronimo.arthur.integration-testwinegrower-cepage-osgi-cdi...winegrower-cepage-osgi-cdino-cxf...no-cxfPossible fixes
Option A (mvnup): When upgrading jar-plugin to 3.5.0, check if any module in the project has a hyphenated artifactId without an explicit
Automatic-Module-Namemanifest entry. If so, either:Automatic-Module-Namewith hyphens replaced by dots/underscoresOption B (jar-plugin): The jar-plugin itself could sanitize the auto-generated module name (e.g. replace hyphens with dots), or skip auto-generation when the result would be invalid, instead of failing the build.
Context
Data from maven4-testing run #13307 testing
maven-4.0.xagainst all Apache projects.