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 7500e43d2a..3644b67ef4 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 @@ -181,18 +181,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 c2ba0a3d72..888f4581b4 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; @@ -316,10 +320,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 {