You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2023/05/26 06:47:52 UTC

[GitHub] [maven] gnodet commented on a diff in pull request #1128: [MNG-7795] IllegalArgumentException: 'other' has different root durin…

gnodet commented on code in PR #1128:
URL: https://github.com/apache/maven/pull/1128#discussion_r1206305183


##########
maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java:
##########
@@ -247,7 +247,11 @@ private String pluginOccurrence(MavenSession mavenSession) {
         File currentPom = prj.getFile();
         if (currentPom != null) {
             File rootBasedir = mavenSession.getTopLevelProject().getBasedir();
-            result += " (" + rootBasedir.toPath().relativize(currentPom.toPath()) + ")";
+            if (currentPom.getPath().startsWith(rootBasedir.getPath())) {

Review Comment:
   I wonder if the path should be absoluted / normalized.  Also, this should be done against the new `Session#getRootDirectory()` imho:
   ```
               Path root = mavenSession.getRootDirectory();
               Path current = currentPom.toPath().toAbsolutePath().normalize();
               if (current.startsWith(root)) {
                   current = root.relativize(current);
               }
               result += " (" + current + ")";
   ```



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org