This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new e568c73876 Nuance the message about filename-based automodules 
detected on the module path (#11857)
e568c73876 is described below

commit e568c73876e5b1d92481252e3bf78dc054c4c16f
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Sat May 23 14:07:09 2026 +0200

    Nuance the message about filename-based automodules detected on the module 
path (#11857)
    
    Nuance the message about filename-based automodules detected on the module 
path.
    Instead of "Please don't publish this project to a public artifact 
repository", said
    "This project may not work if consumers use these dependencies with 
different filenames."".
    
    Co-authored-by: Guillaume Nodet <[email protected]>
---
 .../java/org/apache/maven/impl/PathModularization.java    | 15 +++++++++------
 .../org/apache/maven/impl/PathModularizationCache.java    |  8 +++++---
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git 
a/impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularization.java 
b/impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularization.java
index a40e57215a..34eca5d5a3 100644
--- 
a/impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularization.java
+++ 
b/impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularization.java
@@ -234,12 +234,15 @@ 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}
-     * for preparing a warning asking to not deploy the build artifact on a 
public repository.
-     * If the module has an explicit name either with a {@code 
module-info.class} file or with
-     * an {@code "Automatic-Module-Name"} attribute in the {@code 
META-INF/MANIFEST.MF} file,
-     * then this method does nothing.
+     * If the JAR has no {@code module-info.class} entry and no {@code 
Automatic-Module-Name}
+     * attribute in JAR's manifest, adds the filename of the JAR file in the 
given collection.
+     * This method should be invoked for all dependencies placed on the 
module-path,
+     * e.g. all dependencies of type {@link JavaPathType#MODULES}.
+     * If the module described by the {@code PathModularization} instance has 
an explicit name
+     * either with a {@code module-info.class} file or with an {@code 
"Automatic-Module-Name"}
+     * attribute in the {@code META-INF/MANIFEST.MF} file, then this method 
does nothing.
+     * Otherwise, this method adds an element in the given {@code 
automodulesDetected} collection.
+     * That collection will be used later for preparing a warning message.
      */
     public void addIfFilenameBasedAutomodules(Collection<String> 
automodulesDetected) {
         if (descriptors.isEmpty()) {
diff --git 
a/impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularizationCache.java
 
b/impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularizationCache.java
index 3ab71dc33c..c03859ae91 100644
--- 
a/impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularizationCache.java
+++ 
b/impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularizationCache.java
@@ -189,10 +189,12 @@ Optional<String> 
warningForFilenameBasedAutomodules(Collection<Path> modulePaths
             return Optional.empty();
         }
         String lineSeparator = System.lineSeparator();
+        String fileSeparator = lineSeparator + "  - ";
         var joiner = new StringJoiner(
-                lineSeparator + "  - ",
-                "Filename-based automodules detected on the module path: " + 
lineSeparator + "  - ",
-                lineSeparator + "Please don't publish this project to a public 
artifact repository.");
+                fileSeparator,
+                "Filename-based automodules detected on the module path: " + 
fileSeparator,
+                lineSeparator + "This project may not work if consumers use "
+                        + "these dependencies with different filenames.");
         automodulesDetected.forEach(joiner::add);
         return Optional.of(joiner.toString());
     }

Reply via email to