Skip to content

Nuance the message about filename-based automodules detected on the module path#11857

Open
desruisseaux wants to merge 2 commits into
apache:masterfrom
Geomatys:nuance-automodule-warning
Open

Nuance the message about filename-based automodules detected on the module path#11857
desruisseaux wants to merge 2 commits into
apache:masterfrom
Geomatys:nuance-automodule-warning

Conversation

@desruisseaux
Copy link
Copy Markdown
Contributor

Instead of "Please don't publish this project to a public artifact repository", said "This project may not work in applications that do not use these dependencies with exactly the same filenames as listed above".

Rational: it can be considered okay to publish the project on a public Maven repository, because the artifact filenames are quite deterministic with Maven. For a pure-Maven project and for bundle generated by the Maven assembly plugin, there is no reason why these filenames would not be stable. Therefore, we can warn the users about the fragility of filename-based automodules but let them decide whether they want to publish anyway.

…odule path.

Instead of "Please don't publish this project to a public artifact repository",
said "This project may not work in applications that do not use these dependencies
with exactly the same filenames as listed above".
@desruisseaux desruisseaux added the java Pull requests that update Java code label Mar 28, 2026
@desruisseaux desruisseaux self-assigned this Mar 28, 2026
@desruisseaux desruisseaux requested a review from elharo March 28, 2026 16:05
@@ -236,7 +236,7 @@ public JavaPathType getPathType() {
/**
* If the module has no name, adds the filename of the JAR file in the given collection.
* This method should be invoked for dependencies placed on {@link JavaPathType#MODULES}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not new here, but this doc comment really is hard to follow or understand. It should be rewritten.

Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code on behalf of Guillaume Nodet

The rationale is sound: the old message was overly prescriptive ("don't publish") when in practice Maven artifact filenames are deterministic. The new wording correctly shifts from a prohibition to an informational warning about the fragility.

Two minor observations below.

Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularizationCache.java Outdated
* If the module has no name, adds the filename of the JAR file in the given collection.
* This method should be invoked for dependencies placed on {@link JavaPathType#MODULES}
* for preparing a warning asking to not deploy the build artifact on a public repository.
* for preparing a warning saying that this project may fail to resolve these modules.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the Javadoc on this method still says "for preparing a warning asking to not deploy the build artifact on a public repository", which no longer matches what the warning actually says. Should be updated to stay consistent with the new message.

Suggested change
* for preparing a warning saying that this project may fail to resolve these modules.
* for preparing a warning saying that this project may fail to resolve these modules.

Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — the new wording is a clear improvement. Minor nits noted inline.

Claude Code on behalf of Guillaume Nodet

@gnodet
Copy link
Copy Markdown
Contributor

gnodet commented May 23, 2026

Claude Code on behalf of Guillaume Nodet

I've pushed a follow-up commit to address the review suggestion about the warning message wording. The commit simplifies the double-negative phrasing:

Before:

This project may not work in applications that do not use these dependencies with exactly the same filenames as listed above.

After:

This project may not work if consumers use these dependencies with different filenames.

The Javadoc update in PathModularization.java was already applied in the existing commit.

The commit is available at gnodet/maven@nuance-automodule-warning — you can cherry-pick it with:

git remote add gnodet https://github.com/gnodet/maven.git
git fetch gnodet nuance-automodule-warning
git cherry-pick gnodet/nuance-automodule-warning

Or I can merge this into the main repo directly if you enable "Allow edits from maintainers" on this PR.

Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
@desruisseaux
Copy link
Copy Markdown
Contributor Author

I couldn't find the "Allow edits from maintainers" checkbox. Even the GitHub documentation does not match what I see. I will cherry pick. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants