Skip to content

[MNG-11642] Add JPMS module support to Maven 4#12135

Draft
gnodet wants to merge 2 commits into
masterfrom
plume-football
Draft

[MNG-11642] Add JPMS module support to Maven 4#12135
gnodet wants to merge 2 commits into
masterfrom
plume-football

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented May 20, 2026

Summary

  • Add explicit module-info.java to 17 modules (11 API + 6 impl) with proper requires, exports, uses, and provides directives
  • Add Automatic-Module-Name manifest entries to all 17 remaining modules (4 impl + 13 compat) via maven-jar-plugin configuration in root POM
  • Resolves Assign automatic module names to core Maven components #11642

Details

Modules with module-info.java (17)

API modules (11): maven-api-annotations, maven-api-di, maven-api-xml, maven-api-metadata, maven-api-model, maven-api-settings, maven-api-toolchain, maven-api-plugin, maven-api-core, maven-api-spi, maven-api-cli

Impl modules (6): maven-di, maven-xml, maven-support, maven-impl (open module), maven-jline, maven-logging

Modules with Automatic-Module-Name only (17)

Impl (4): maven-core, maven-cli, maven-executor, maven-testing — cannot use module-info.java due to split packages with compat modules or complex DI/compat dependencies

Compat (13): All compat modules — split packages among themselves prevent named module status

Notable decisions

  • maven-impl is an open module because Maven's DI framework needs reflective access to instantiate components
  • maven-cli was originally planned for module-info.java but was downgraded to Automatic-Module-Name due to split packages between compat modules it depends on (e.g., org.apache.maven.settings in both maven-settings and maven-core)
  • maven-api-model declares uses ModelObjectProcessor for ServiceLoader support
  • maven-impl declares uses RootDetector for ServiceLoader support
  • maven-impl surefire configured with useModulePath=false to preserve existing test behavior

Test plan

  • mvn verify -B -DskipTests — all 34 modules compile successfully
  • mvn verify -B — all tests pass except pre-existing failures unrelated to this PR (Mimir daemon tests in maven-cli/maven-executor, DI binding tests in maven-impl that also fail on master)
  • Verified jar --describe-module shows correct module descriptors for all 17 module-info modules
  • Verified Automatic-Module-Name manifest entries present in all 17 remaining module JARs

🤖 Generated with Claude Code

gnodet and others added 2 commits May 20, 2026 15:45
Add explicit module-info.java to 17 modules (11 API, 6 impl) and
Automatic-Module-Name manifest entries to all 34 remaining modules.

API modules get full module descriptors with proper requires
transitive, exports, uses, and provides directives. Impl modules
that don't depend on compat (split-package) modules also get
module-info.java. The remaining modules (maven-core, maven-cli,
maven-executor, maven-testing, and all 13 compat modules) get
Automatic-Module-Name only, since split packages between compat
modules prevent them from becoming named modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configure annotationProcessorPaths for maven-impl, maven-di, and
maven-jline to ensure the DiIndexProcessor runs during modular
compilation and generates META-INF/maven/org.apache.maven.api.di.Inject.

Default @nullable collection parameters to empty collections in
DefaultModelProcessor and DefaultModelBuilder to prevent NPE when
no implementations are available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assign automatic module names to core Maven components

1 participant