diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 13f863c4f9..b2ab46dc97 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -4,6 +4,7 @@ import org.apache.maven.artifact.AbstractArtifactComponent; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.wagon.TransferFailedException; @@ -115,24 +116,26 @@ public class DefaultArtifactResolver ArtifactMetadataSource source ) throws ArtifactResolutionException { + ArtifactResolutionResult artifactResolutionResult; + try { - ArtifactResolutionResult artifactResolutionResult = collect( artifacts, - localRepository, - remoteRepositories, - source ); - - for ( Iterator i = artifactResolutionResult.getArtifacts().values().iterator(); i.hasNext(); ) - { - resolve( (Artifact) i.next(), remoteRepositories, localRepository ); - } - - return artifactResolutionResult; + artifactResolutionResult = collect( artifacts, + localRepository, + remoteRepositories, + source ); } - catch ( ArtifactCollectionException e ) + catch ( TransitiveArtifactResolutionException e ) { - throw new ArtifactResolutionException( "Error while resolving transitive dependencies: ", e ); + throw new ArtifactResolutionException( "Error transitively resolving artifacts: ", e ); } + + for ( Iterator i = artifactResolutionResult.getArtifacts().values().iterator(); i.hasNext(); ) + { + resolve( (Artifact) i.next(), remoteRepositories, localRepository ); + } + + return artifactResolutionResult; } public ArtifactResolutionResult resolveTransitively( Artifact artifact, @@ -157,7 +160,7 @@ public class DefaultArtifactResolver ArtifactRepository localRepository, Set remoteRepositories, ArtifactMetadataSource source ) - throws ArtifactCollectionException + throws TransitiveArtifactResolutionException { ArtifactResolutionResult result = new ArtifactResolutionResult(); @@ -187,13 +190,7 @@ public class DefaultArtifactResolver if ( !newVersion.equals( knownVersion ) ) { - /* - getLogger().warn( "Version conflict: " + id + ", " + - "using version: " + knownArtifact.getVersion() + ", " + - "found version: " + newArtifact.getVersion() ); - addConflict( result, knownArtifact, newArtifact ); - */ } } else @@ -207,9 +204,9 @@ public class DefaultArtifactResolver { referencedDependencies = source.retrieve( newArtifact ); } - catch ( Exception e ) + catch ( ArtifactMetadataRetrievalException e ) { - throw new ArtifactCollectionException( "Problem building project: ", e ); + throw new TransitiveArtifactResolutionException( "Error retrieving metadata: ", e ); } // the pom for given dependency exisit we will add it to the queue diff --git a/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java b/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java index fd2d67b07b..affc55c0ef 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java @@ -4,6 +4,7 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.model.Dependency; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader;