From 7f736625f55c5f815843c26d428653599540f9f5 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Thu, 27 Oct 2005 04:00:18 +0000 Subject: [PATCH] o the artifact resolver should continue with the next artifact in the resolution group even after it could not find one, and throw an exception at the end that lists all the artifacts that could not be found. http://jira.codehaus.org/browse/MNG-1198 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@328782 13f79535-47bb-0310-9956-ffa450edef68 --- .../resolver/DefaultArtifactResolver.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 18cece89e2..212ddf3280 100644 --- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -224,10 +224,31 @@ public class DefaultArtifactResolver localRepository, remoteRepositories, source, filter, listeners ); + List missingArtifacts = new ArrayList(); for ( Iterator i = artifactResolutionResult.getArtifactResolutionNodes().iterator(); i.hasNext(); ) { ResolutionNode node = (ResolutionNode) i.next(); - resolve( node.getArtifact(), node.getRemoteRepositories(), localRepository ); + try + { + resolve( node.getArtifact(), node.getRemoteRepositories(), localRepository ); + } + catch ( ArtifactNotFoundException anfe ) + { + getLogger().debug( anfe.getMessage() ); + missingArtifacts.add( node.getArtifact() ); + } + } + + if ( missingArtifacts.size() > 0 ) + { + String message = "required artifacts missing:\n"; + for( Iterator i=missingArtifacts.iterator(); i.hasNext(); ) + { + Artifact missingArtifact = (Artifact) i.next(); + message += " " + missingArtifact.getId() + "\n"; + } + message += "\nfor the artifact:"; + throw new ArtifactResolutionException( message, originatingArtifact, remoteRepositories ); } return artifactResolutionResult;