From ba677b1fb9b0f456b6e52b2e87fc28b063cc288f Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 6 Mar 2009 14:03:38 +0000 Subject: [PATCH] o Improved error reporting git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@750906 13f79535-47bb-0310-9956-ffa450edef68 --- .../artifact/resolver/DefaultArtifactResolver.java | 3 ++- .../maven/project/DefaultMavenProjectBuilder.java | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 89ed657983..4c50e8789a 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -162,7 +162,8 @@ public class DefaultArtifactResolver { if ( !isOnline() ) { - throw new ArtifactNotFoundException( "The repository system is offline.", artifact ); + throw new ArtifactResolutionException( "The repository system is offline and the artifact " + + artifact + " is not available in the local repository.", artifact ); } try diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index 8679a86fa7..5a5ba02bfa 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -695,7 +695,17 @@ public class DefaultMavenProjectBuilder Artifact artifactParent = repositorySystem.createParentArtifact( domainModel.getParentGroupId(), domainModel.getParentArtifactId(), domainModel.getParentVersion() ); - ArtifactResolutionResult result = repositorySystem.resolve( new ArtifactResolutionRequest( artifactParent, localRepository, remoteRepositories ) ); + ArtifactResolutionRequest request = new ArtifactResolutionRequest( artifactParent, localRepository, remoteRepositories ); + ArtifactResolutionResult result = repositorySystem.resolve( request ); + try + { + resolutionErrorHandler.throwErrors( request, result ); + } + catch ( ArtifactResolutionException e ) + { + throw (IOException) new IOException( "The parent POM " + artifactParent + + " could not be retrieved from any repository" ).initCause( e ); + } PomClassicDomainModel parentDomainModel = new PomClassicDomainModel( artifactParent.getFile() );