diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java index d6cc0806d9..267dc2d0b7 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java @@ -184,18 +184,6 @@ public class DefaultProjectDependenciesResolver depRequest.setRoot( node ); - if ( logger.isWarnEnabled() ) - { - for ( DependencyNode child : node.getChildren() ) - { - if ( !child.getRelocations().isEmpty() ) - { - logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to " - + child.getDependency().getArtifact() ); - } - } - } - if ( logger.isDebugEnabled() ) { node.accept( new GraphLogger( project ) ); diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java index eed6f6071e..af88442cbf 100644 --- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java +++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java @@ -68,6 +68,8 @@ import org.eclipse.aether.resolution.VersionResult; import org.eclipse.aether.spi.locator.Service; import org.eclipse.aether.spi.locator.ServiceLocator; import org.eclipse.aether.transfer.ArtifactNotFoundException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Benjamin Bentmann @@ -77,6 +79,8 @@ import org.eclipse.aether.transfer.ArtifactNotFoundException; public class DefaultArtifactDescriptorReader implements ArtifactDescriptorReader, Service { + private static final Logger LOGGER = LoggerFactory.getLogger( DefaultArtifactDescriptorReader.class ); + private RemoteRepositoryManager remoteRepositoryManager; private VersionResolver versionResolver; @@ -319,10 +323,20 @@ public class DefaultArtifactDescriptorReader if ( relocation != null ) { result.addRelocation( a ); - a = + Artifact relocatedArtifact = new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(), relocation.getVersion() ); - result.setArtifact( a ); + if ( LOGGER.isWarnEnabled() ) + { + String message = "The artifact " + a + " has been relocated to " + relocatedArtifact; + if ( relocation.getMessage() != null ) + { + message += ": " + relocation.getMessage(); + } + LOGGER.warn( message ); + } + result.setArtifact( relocatedArtifact ); + a = relocatedArtifact; } else {