Skip to content

Add Java automatic module names to published artifacts - #11858

Open
raphw wants to merge 2 commits into
testcontainers:mainfrom
raphw:automatic-module-names
Open

raphw wants to merge 2 commits into
testcontainers:mainfrom
raphw:automatic-module-names

Conversation

@raphw

@raphw raphw commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What

Adds a JPMS Automatic-Module-Name manifest attribute to every published artifact.

The name is derived from the group id (org.testcontainers) plus a single trailing element based on the artifact name, with hyphens collapsed:

Artifact Automatic-Module-Name
testcontainers (core) org.testcontainers.core
testcontainers-mysql org.testcontainers.mysql
testcontainers-junit-jupiter org.testcontainers.junitjupiter
testcontainers-oracle-free org.testcontainers.oraclefree
testcontainers-database-commons org.testcontainers.databasecommons

Why

Giving consumers stable module names lets them requires Testcontainers from a module-info.java without depending on the unstable filename-derived automatic name.

How

A single addition to gradle/publishing.gradle, which is already applied to exactly the set of published projects. The attribute is set on the jar manifest and inherited by the published shadowJar. This keeps the change minimal and leaves non-published artifacts (e.g. test-support, jdbc-test) untouched. Existing manifest attributes (such as core's Implementation-Version) are preserved.

Summary by CodeRabbit

  • New Features
    • Published JAR files now include a stable automatic module name, improving compatibility with Java’s module system.
    • Shadowed JAR artifacts inherit the same module metadata.

Set an Automatic-Module-Name manifest attribute on every published
artifact, derived from the group id plus a trailing element based on the
artifact name (e.g. testcontainers-junit-jupiter -> org.testcontainers.junitjupiter,
core -> org.testcontainers.core). The attribute is added to the jar
manifest and inherited by the published shadowJar.
@raphw
raphw requested a review from a team as a code owner June 26, 2026 15:21
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 8a5f57ec-2cd4-4e51-bad4-20a856fd31e4

📥 Commits

Reviewing files that changed from the base of the PR and between 8e54951 and 217f8af.

📒 Files selected for processing (1)
  • gradle/publishing.gradle

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The publishing configuration adds an Automatic-Module-Name manifest attribute to JAR artifacts. The name uses the group ID and a normalized project name. The shadowJar task inherits the attribute.

Changes

Module Naming

Layer / File(s) Summary
Manifest module-name configuration
gradle/publishing.gradle
The jar task derives normalized module names, such as org.testcontainers.core and org.testcontainers.junitjupiter, and adds them to the manifest. The shadowJar task inherits the attribute.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: eddumelendez

Merge Risk: ⚪ Minimal · up to 217f8

The change is limited to adding stable module names to published artifacts without affecting existing manifest entries or BOM publication.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding Java automatic module names to published artifacts.
Description check ✅ Passed The description is complete and relevant. It explains what changed, why it is useful, how it is implemented, affected artifacts, and preserved behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@raphw

raphw commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Any chance to consider this?

@raphw raphw changed the title Add JPMS automatic module names to published artifacts Add Java automatic module names to published artifacts Sep 14, 2026
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.

1 participant