ascheman commented on PR #11549:
URL: https://github.com/apache/maven/pull/11549#issuecomment-3655167156

   > > is there a jar associated to the original artifactId?
   > 
   > No when using the module source hierarchy. Reminder: nothing change when 
using the traditional package hierarchy.
   > 
   > > when I read "This is needed by the new Maven JAR Plugin proposal 
[apache/maven-jar-plugin#508](https://github.com/apache/maven-jar-plugin/pull/508).",
 I don't get the relationship with using jar vs MavenArchiver: we need to be 
cautious
   > 
   > The new proposed JAR plugin automatically detects when module hierarchy is 
used, and produces one JAR per module in that case. However, it results in an 
exception thrown by Maven core if the relaxation proposed in this pull request 
is not applied. Reminder: again, nothing change when the JAR plugin detects 
that the traditional package hierarchy was used.
   
   To make clear that the relaxation is only necessary and used in the case of 
multi-module JARs, the proposed change could be adapted to check whether the 
`project` is multi-module and only leave out the comparison of artifactId in 
this case (as suggested before):
   
   ```java
   ...
     String a1 = project.getArtifactId();
     String a2 = artifact.getArtifactId();
   ...
     // ArtifactId may differ only for multi-module projects (source roots with 
module name)
     boolean isMultiModule = getSourceRoots(project).stream().anyMatch(sr -> 
sr.module().isPresent());
     if (!Objects.equals(a1, a2) && !isMultiModule) {
         throw new IllegalArgumentException(...);
     }
   ...
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to