logger.warn( message );
}
if ( project != null )
{
Relocation relocation = null;
DistributionManagement distMgmt = project.getDistributionManagement();
if ( distMgmt != null )
{
relocation = distMgmt.getRelocation();
artifact.setDownloadUrl( distMgmt.getDownloadUrl() );
pomArtifact.setDownloadUrl( distMgmt.getDownloadUrl() );
}
if ( relocation != null )
{
if ( relocation.getGroupId() != null )
{
artifact.setGroupId( relocation.getGroupId() );
relocatedArtifact = artifact;
project.setGroupId( relocation.getGroupId() );
}
if ( relocation.getArtifactId() != null )
{
artifact.setArtifactId( relocation.getArtifactId() );
relocatedArtifact = artifact;
project.setArtifactId( relocation.getArtifactId() );
}
if ( relocation.getVersion() != null )
{
// note: see MNG-3454. This causes a problem, but fixing it may break more.
artifact.setVersionRange( VersionRange.createFromVersion( relocation.getVersion() ) );
relocatedArtifact = artifact;
project.setVersion( relocation.getVersion() );
}
if ( artifact.getDependencyFilter() != null
&& !artifact.getDependencyFilter().include( artifact ) )
{
return null;
}
// MNG-2861: the artifact data has changed. If the available versions where previously
// retrieved, we need to update it.
// TODO: shouldn't the versions be merged across relocations?
List<ArtifactVersion> available = artifact.getAvailableVersions();
if ( available != null && !available.isEmpty() )
{
MetadataResolutionRequest metadataRequest =
new DefaultMetadataResolutionRequest( repositoryRequest );
metadataRequest.setArtifact( artifact );
available = retrieveAvailableVersions( metadataRequest );
artifact.setAvailableVersions( available );
}
String message =
"\n This artifact has been relocated to " + artifact.getGroupId() + ":"
+ artifact.getArtifactId() + ":" + artifact.getVersion() + ".\n";
if ( relocation.getMessage() != null )
{
message += " " + relocation.getMessage() + "\n";
}
if ( artifact.getDependencyTrail() != null && artifact.getDependencyTrail().size() == 1 )
{
logger.warn( "While downloading " + pomArtifact.getGroupId() + ":"