Skip to content

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

Open
desruisseaux wants to merge 1 commit intoapache:masterfrom
Geomatys:nuance-automodule-warning
Open

Nuance the message about filename-based automodules detected on the module path#11857
desruisseaux wants to merge 1 commit intoapache: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.

fileSeparator,
"Filename-based automodules detected on the module path: " + fileSeparator,
lineSeparator + "This project may not work in applications that do not use "
+ "these dependencies with exactly the same filenames as listed above.");
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.

Is this only an issue when JPMS is used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is an issue if non-modular JARs are placed on the --module-path option. While not recommended, this is not forbidden neither in order to allow gradual transition, because the effect is not the same as keeping those JARs on --class-path. The javac tool already emits a warning for such cases, and developers may accept the risk if they understand the condition in which it works, which is to keep the JAR filenames unchanged.

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.

2 participants