mirror of https://github.com/apache/maven.git
PR: MNG-344
correctly render exceptions for initial project retrieval failure git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@169591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8fc3e7a305
commit
c334dfaf2a
|
@ -80,28 +80,26 @@ public class ArtifactResolutionException
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: don't show this section for metadata
|
||||
sb.append( LS );
|
||||
sb.append( LS );
|
||||
sb.append( "Try downloading the file manually" );
|
||||
if ( downloadUrl != null )
|
||||
if ( downloadUrl != null && !type.equals( "pom" ) )
|
||||
{
|
||||
sb.append( " from " );
|
||||
sb.append( LS );
|
||||
sb.append( LS );
|
||||
sb.append( "Try downloading the file manually from" );
|
||||
sb.append( LS );
|
||||
sb.append( " " + downloadUrl );
|
||||
sb.append( LS );
|
||||
sb.append( "and install it using the command: " );
|
||||
sb.append( LS );
|
||||
sb.append( " m2 install:install-file -DgroupId=" );
|
||||
sb.append( groupId );
|
||||
sb.append( " -DartifactId=" );
|
||||
sb.append( artifactId );
|
||||
sb.append( " -Dversion=" );
|
||||
sb.append( version );
|
||||
sb.append( " -Dpackaging=" );
|
||||
sb.append( type );
|
||||
sb.append( " -Dfile=/path/to/file" );
|
||||
}
|
||||
sb.append( LS );
|
||||
sb.append( "and install it using the command: " );
|
||||
sb.append( LS );
|
||||
sb.append( " m2 install:install-file -DgroupId=" );
|
||||
sb.append( groupId );
|
||||
sb.append( " -DartifactId=" );
|
||||
sb.append( artifactId );
|
||||
sb.append( " -Dversion=" );
|
||||
sb.append( version );
|
||||
sb.append( " -Dpackaging=" );
|
||||
sb.append( type );
|
||||
sb.append( " -Dfile=/path/to/file" );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ import java.util.Map;
|
|||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||
* @version $Id$
|
||||
* @todo unify error reporting. We should return one response, always - and let the CLI decide how to render it. The reactor response should contain individual project responses
|
||||
*/
|
||||
public class DefaultMaven
|
||||
extends AbstractLogEnabled
|
||||
|
@ -120,17 +121,33 @@ public class DefaultMaven
|
|||
{
|
||||
throw new ReactorException( "Error processing projects for the reactor: ", e );
|
||||
}
|
||||
catch ( ProjectBuildingException e )
|
||||
{
|
||||
throw new ReactorException( "Error processing projects for the reactor: ", e );
|
||||
}
|
||||
catch ( CycleDetectedException e )
|
||||
{
|
||||
throw new ReactorException( "Error processing projects for the reactor: ", e );
|
||||
}
|
||||
catch ( ArtifactResolutionException e )
|
||||
{
|
||||
throw new ReactorException( "Error processing projects for the reactor: ", e );
|
||||
dispatcher.dispatchError( event, request.getBaseDirectory(), e );
|
||||
|
||||
MavenExecutionResponse response = new MavenExecutionResponse();
|
||||
response.setStart( new Date() );
|
||||
response.setFinish( new Date() );
|
||||
response.setException( e );
|
||||
logFailure( response, e, null );
|
||||
|
||||
return response;
|
||||
}
|
||||
catch ( ProjectBuildingException e )
|
||||
{
|
||||
dispatcher.dispatchError( event, request.getBaseDirectory(), e );
|
||||
|
||||
MavenExecutionResponse response = new MavenExecutionResponse();
|
||||
response.setStart( new Date() );
|
||||
response.setFinish( new Date() );
|
||||
response.setException( e );
|
||||
logFailure( response, e, null );
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -150,6 +167,8 @@ public class DefaultMaven
|
|||
MavenExecutionResponse response = processProject( request, project, dispatcher );
|
||||
if ( response.isExecutionFailure() )
|
||||
{
|
||||
dispatcher.dispatchError( event, request.getBaseDirectory(), response.getException() );
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -414,6 +433,7 @@ public class DefaultMaven
|
|||
line();
|
||||
}
|
||||
|
||||
// TODO: needs to honour -e
|
||||
if ( getLogger().isDebugEnabled() )
|
||||
{
|
||||
getLogger().debug( "Trace", e );
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven;
|
|||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.execution.MavenExecutionResponse;
|
||||
import org.apache.maven.reactor.ReactorException;
|
||||
import org.apache.maven.project.ProjectBuildingException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||
|
|
|
@ -272,7 +272,7 @@ public class MavenCli
|
|||
}
|
||||
else
|
||||
{
|
||||
System.err.println( "For more information, run with the -X flag" );
|
||||
System.err.println( "For more information, run with the -e flag" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue