mirror of https://github.com/apache/maven.git
[MNG-7253] Display relocation message defined in model
Move logging to DefaultArtifactDescriptorReader This closes #544
This commit is contained in:
parent
8c66edc041
commit
ab54d17dc2
|
@ -181,18 +181,6 @@ public class DefaultProjectDependenciesResolver
|
||||||
|
|
||||||
depRequest.setRoot( node );
|
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() )
|
if ( logger.isDebugEnabled() )
|
||||||
{
|
{
|
||||||
node.accept( new GraphLogger( project ) );
|
node.accept( new GraphLogger( project ) );
|
||||||
|
|
|
@ -68,6 +68,8 @@ import org.eclipse.aether.resolution.VersionResult;
|
||||||
import org.eclipse.aether.spi.locator.Service;
|
import org.eclipse.aether.spi.locator.Service;
|
||||||
import org.eclipse.aether.spi.locator.ServiceLocator;
|
import org.eclipse.aether.spi.locator.ServiceLocator;
|
||||||
import org.eclipse.aether.transfer.ArtifactNotFoundException;
|
import org.eclipse.aether.transfer.ArtifactNotFoundException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
|
@ -77,6 +79,8 @@ import org.eclipse.aether.transfer.ArtifactNotFoundException;
|
||||||
public class DefaultArtifactDescriptorReader
|
public class DefaultArtifactDescriptorReader
|
||||||
implements ArtifactDescriptorReader, Service
|
implements ArtifactDescriptorReader, Service
|
||||||
{
|
{
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger( DefaultArtifactDescriptorReader.class );
|
||||||
|
|
||||||
private RemoteRepositoryManager remoteRepositoryManager;
|
private RemoteRepositoryManager remoteRepositoryManager;
|
||||||
|
|
||||||
private VersionResolver versionResolver;
|
private VersionResolver versionResolver;
|
||||||
|
@ -316,10 +320,20 @@ public class DefaultArtifactDescriptorReader
|
||||||
if ( relocation != null )
|
if ( relocation != null )
|
||||||
{
|
{
|
||||||
result.addRelocation( a );
|
result.addRelocation( a );
|
||||||
a =
|
Artifact relocatedArtifact =
|
||||||
new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
|
new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
|
||||||
relocation.getVersion() );
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue