You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/01/21 09:46:19 UTC

[GitHub] [maven] gnodet commented on a change in pull request #657: [3.8.x][MNG-7349] Limit relocation warning message to direct dependencies only

gnodet commented on a change in pull request #657:
URL: https://github.com/apache/maven/pull/657#discussion_r789505567



##########
File path: maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
##########
@@ -205,6 +205,22 @@ private DependencyNode resolveInternal( Plugin plugin, Artifact pluginArtifact,
 
             node = repoSystem.collectDependencies( pluginSession, request ).getRoot();
 
+            if ( logger.isWarnEnabled() )
+            {
+                for ( DependencyNode child : node.getChildren() )
+                {
+                    if ( !child.getRelocations().isEmpty() )
+                    {
+                        org.eclipse.aether.artifact.Artifact relocated = child.getDependency().getArtifact();
+                        String message = relocated instanceof org.apache.maven.repository.internal.RelocatedArtifact
+                                ? ( ( org.apache.maven.repository.internal.RelocatedArtifact ) relocated ).getMessage()
+                                : null;
+                        logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to "
+                                + relocated + ( message != null ? ": " + message : "" ) );
+                    }
+                }
+            }
+

Review comment:
       Good catch, I've been fooled by the not strict enough testing I added in https://github.com/apache/maven-integration-testing/pull/134/files.  It's testing the plugin's first level dependencies relocations instead of the plugin itself.




-- 
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