Skip to content

mvnup: jar-plugin upgrade to 3.5.0 produces invalid automatic module names for hyphenated artifactIds #12984

Description

@gnodet

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions