mirror of https://github.com/apache/maven.git
o Restored backward-compat with Maven 2.x
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@955820 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d6e04a3d49
commit
e733004eb1
|
@ -537,15 +537,6 @@ public class DefaultLegacyArtifactCollector
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Artifact relocated = rGroup.getRelocatedArtifact();
|
|
||||||
if ( relocated != null && !artifact.equals( relocated ) )
|
|
||||||
{
|
|
||||||
relocated.setDependencyFilter( artifact.getDependencyFilter() );
|
|
||||||
artifact = relocated;
|
|
||||||
child.setArtifact( artifact );
|
|
||||||
metadataRequest.setArtifact( artifact );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
while( !childKey.equals( child.getKey() ) );
|
while( !childKey.equals( child.getKey() ) );
|
||||||
|
|
||||||
|
|
|
@ -535,23 +535,23 @@ public class MavenMetadataSource
|
||||||
MavenProject project;
|
MavenProject project;
|
||||||
|
|
||||||
Artifact pomArtifact;
|
Artifact pomArtifact;
|
||||||
Artifact relocatedArtifact = artifact;
|
Artifact relocatedArtifact = null;
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
project = null;
|
project = null;
|
||||||
|
|
||||||
pomArtifact =
|
pomArtifact =
|
||||||
repositorySystem.createProjectArtifact( relocatedArtifact.getGroupId(),
|
repositorySystem.createProjectArtifact( artifact.getGroupId(),
|
||||||
relocatedArtifact.getArtifactId(),
|
artifact.getArtifactId(),
|
||||||
relocatedArtifact.getVersion(), relocatedArtifact.getScope() );
|
artifact.getVersion(), artifact.getScope() );
|
||||||
|
|
||||||
if ( "pom".equals( relocatedArtifact.getType() ) )
|
if ( "pom".equals( artifact.getType() ) )
|
||||||
{
|
{
|
||||||
pomArtifact.setFile( relocatedArtifact.getFile() );
|
pomArtifact.setFile( artifact.getFile() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Artifact.SCOPE_SYSTEM.equals( relocatedArtifact.getScope() ) )
|
if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
@ -581,27 +581,27 @@ public class MavenMetadataSource
|
||||||
if ( missingParentPom != null )
|
if ( missingParentPom != null )
|
||||||
{
|
{
|
||||||
throw new ArtifactMetadataRetrievalException( "Failed to process POM for "
|
throw new ArtifactMetadataRetrievalException( "Failed to process POM for "
|
||||||
+ relocatedArtifact.getId() + ": " + missingParentPom.getMessage(),
|
+ artifact.getId() + ": " + missingParentPom.getMessage(),
|
||||||
missingParentPom.getException(),
|
missingParentPom.getException(),
|
||||||
relocatedArtifact );
|
artifact );
|
||||||
}
|
}
|
||||||
|
|
||||||
String message;
|
String message;
|
||||||
|
|
||||||
if ( e.getCause() instanceof MultipleArtifactsNotFoundException )
|
if ( e.getCause() instanceof MultipleArtifactsNotFoundException )
|
||||||
{
|
{
|
||||||
message = "Missing POM for " + relocatedArtifact.getId();
|
message = "Missing POM for " + artifact.getId();
|
||||||
}
|
}
|
||||||
else if ( e.getCause() instanceof ArtifactResolutionException )
|
else if ( e.getCause() instanceof ArtifactResolutionException )
|
||||||
{
|
{
|
||||||
throw new ArtifactMetadataRetrievalException( "Failed to retrieve POM for "
|
throw new ArtifactMetadataRetrievalException( "Failed to retrieve POM for "
|
||||||
+ relocatedArtifact.getId() + ": " + e.getCause().getMessage(), e.getCause(),
|
+ artifact.getId() + ": " + e.getCause().getMessage(), e.getCause(),
|
||||||
relocatedArtifact );
|
artifact );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message =
|
message =
|
||||||
"Invalid POM for " + relocatedArtifact.getId()
|
"Invalid POM for " + artifact.getId()
|
||||||
+ ", transitive dependencies (if any) will not be available"
|
+ ", transitive dependencies (if any) will not be available"
|
||||||
+ ", enable debug logging for more details";
|
+ ", enable debug logging for more details";
|
||||||
}
|
}
|
||||||
|
@ -623,36 +623,34 @@ public class MavenMetadataSource
|
||||||
{
|
{
|
||||||
relocation = distMgmt.getRelocation();
|
relocation = distMgmt.getRelocation();
|
||||||
|
|
||||||
relocatedArtifact.setDownloadUrl( distMgmt.getDownloadUrl() );
|
artifact.setDownloadUrl( distMgmt.getDownloadUrl() );
|
||||||
pomArtifact.setDownloadUrl( distMgmt.getDownloadUrl() );
|
pomArtifact.setDownloadUrl( distMgmt.getDownloadUrl() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( relocation != null )
|
if ( relocation != null )
|
||||||
{
|
{
|
||||||
if ( relocatedArtifact == artifact )
|
|
||||||
{
|
|
||||||
relocatedArtifact = ArtifactUtils.copyArtifact( artifact );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( relocation.getGroupId() != null )
|
if ( relocation.getGroupId() != null )
|
||||||
{
|
{
|
||||||
relocatedArtifact.setGroupId( relocation.getGroupId() );
|
artifact.setGroupId( relocation.getGroupId() );
|
||||||
|
relocatedArtifact = artifact;
|
||||||
project.setGroupId( relocation.getGroupId() );
|
project.setGroupId( relocation.getGroupId() );
|
||||||
}
|
}
|
||||||
if ( relocation.getArtifactId() != null )
|
if ( relocation.getArtifactId() != null )
|
||||||
{
|
{
|
||||||
relocatedArtifact.setArtifactId( relocation.getArtifactId() );
|
artifact.setArtifactId( relocation.getArtifactId() );
|
||||||
|
relocatedArtifact = artifact;
|
||||||
project.setArtifactId( relocation.getArtifactId() );
|
project.setArtifactId( relocation.getArtifactId() );
|
||||||
}
|
}
|
||||||
if ( relocation.getVersion() != null )
|
if ( relocation.getVersion() != null )
|
||||||
{
|
{
|
||||||
// note: see MNG-3454. This causes a problem, but fixing it may break more.
|
// note: see MNG-3454. This causes a problem, but fixing it may break more.
|
||||||
relocatedArtifact.setVersionRange( VersionRange.createFromVersion( relocation.getVersion() ) );
|
artifact.setVersionRange( VersionRange.createFromVersion( relocation.getVersion() ) );
|
||||||
|
relocatedArtifact = artifact;
|
||||||
project.setVersion( relocation.getVersion() );
|
project.setVersion( relocation.getVersion() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( artifact.getDependencyFilter() != null
|
if ( artifact.getDependencyFilter() != null
|
||||||
&& !artifact.getDependencyFilter().include( relocatedArtifact ) )
|
&& !artifact.getDependencyFilter().include( artifact ) )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -665,14 +663,14 @@ public class MavenMetadataSource
|
||||||
{
|
{
|
||||||
MetadataResolutionRequest metadataRequest =
|
MetadataResolutionRequest metadataRequest =
|
||||||
new DefaultMetadataResolutionRequest( repositoryRequest );
|
new DefaultMetadataResolutionRequest( repositoryRequest );
|
||||||
metadataRequest.setArtifact( relocatedArtifact );
|
metadataRequest.setArtifact( artifact );
|
||||||
available = retrieveAvailableVersions( metadataRequest );
|
available = retrieveAvailableVersions( metadataRequest );
|
||||||
relocatedArtifact.setAvailableVersions( available );
|
artifact.setAvailableVersions( available );
|
||||||
}
|
}
|
||||||
|
|
||||||
String message =
|
String message =
|
||||||
"\n This artifact has been relocated to " + relocatedArtifact.getGroupId() + ":"
|
"\n This artifact has been relocated to " + artifact.getGroupId() + ":"
|
||||||
+ relocatedArtifact.getArtifactId() + ":" + relocatedArtifact.getVersion() + ".\n";
|
+ artifact.getArtifactId() + ":" + artifact.getVersion() + ".\n";
|
||||||
|
|
||||||
if ( relocation.getMessage() != null )
|
if ( relocation.getMessage() != null )
|
||||||
{
|
{
|
||||||
|
@ -706,7 +704,7 @@ public class MavenMetadataSource
|
||||||
ProjectRelocation rel = new ProjectRelocation();
|
ProjectRelocation rel = new ProjectRelocation();
|
||||||
rel.project = project;
|
rel.project = project;
|
||||||
rel.pomArtifact = pomArtifact;
|
rel.pomArtifact = pomArtifact;
|
||||||
rel.relocatedArtifact = ( relocatedArtifact == artifact ) ? null : relocatedArtifact;
|
rel.relocatedArtifact = relocatedArtifact;
|
||||||
|
|
||||||
return rel;
|
return rel;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue