mirror of https://github.com/apache/maven.git
improve error handling for failed downloads
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@164058 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a0b2d27b38
commit
c7e407ba12
|
@ -20,6 +20,7 @@ package org.apache.maven;
|
||||||
import org.apache.maven.artifact.manager.WagonManager;
|
import org.apache.maven.artifact.manager.WagonManager;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||||
|
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionResponse;
|
import org.apache.maven.execution.MavenExecutionResponse;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
|
@ -246,7 +247,8 @@ public class DefaultMaven
|
||||||
{
|
{
|
||||||
if ( exception.getCause() == null )
|
if ( exception.getCause() == null )
|
||||||
{
|
{
|
||||||
logFailure( response, (PluginExecutionException) exception );
|
PluginExecutionException e = (PluginExecutionException) exception;
|
||||||
|
logFailure( response, e, e.getLongMessage() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -254,6 +256,10 @@ public class DefaultMaven
|
||||||
logError( response );
|
logError( response );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( exception instanceof ArtifactResolutionException )
|
||||||
|
{
|
||||||
|
logFailure( response, exception, null );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: this should be a "FATAL" exception, reported to the
|
// TODO: this should be a "FATAL" exception, reported to the
|
||||||
|
@ -354,7 +360,7 @@ public class DefaultMaven
|
||||||
line();
|
line();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void logFailure( MavenExecutionResponse r, PluginExecutionException e )
|
protected void logFailure( MavenExecutionResponse r, Throwable e, String longMessage )
|
||||||
{
|
{
|
||||||
line();
|
line();
|
||||||
|
|
||||||
|
@ -366,9 +372,9 @@ public class DefaultMaven
|
||||||
|
|
||||||
line();
|
line();
|
||||||
|
|
||||||
if ( e.getLongMessage() != null )
|
if ( longMessage != null )
|
||||||
{
|
{
|
||||||
getLogger().info( e.getLongMessage() );
|
getLogger().info( longMessage );
|
||||||
|
|
||||||
line();
|
line();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.project;
|
||||||
import org.apache.maven.MavenConstants;
|
import org.apache.maven.MavenConstants;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.MavenMetadataSource;
|
import org.apache.maven.artifact.MavenMetadataSource;
|
||||||
|
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||||
|
@ -178,7 +179,6 @@ public class DefaultMavenProjectBuilder
|
||||||
ArtifactRepository localRepository )
|
ArtifactRepository localRepository )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
Settings settings = readSettings();
|
|
||||||
|
|
||||||
Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository );
|
Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue