MNG-2398: the lifecycle executor exception wasn't being propagated properly.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@572210 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-09-03 01:39:28 +00:00
parent cfa367dff1
commit 5380116b79
2 changed files with 20 additions and 24 deletions

View File

@ -37,6 +37,7 @@ import org.apache.maven.execution.SessionContext;
import org.apache.maven.extension.BuildExtensionScanner;
import org.apache.maven.extension.ExtensionScanningException;
import org.apache.maven.lifecycle.LifecycleExecutor;
import org.apache.maven.lifecycle.LifecycleUtils;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
@ -225,6 +226,8 @@ public class DefaultMaven
new BuildFailureException(
e.getMessage(),
e ) );
return result;
}
// old doExecute

View File

@ -271,7 +271,7 @@ public class MavenCli
{
transferListener = new BatchModeDownloadMonitor();
}
transferListener.setShowChecksumEvents( false );
// This means to scan a directory structure for POMs and process them.
@ -348,14 +348,14 @@ public class MavenCli
if ( cvr.isUserSettingsFilePresent() && !cvr.isUserSettingsFileParses() )
{
showFatalError( "Error reading user settings: " + cvr.getUserSettingsException().getMessage(), cvr.getUserSettingsException(), showErrors );
showError( "Error reading user settings: ", cvr.getUserSettingsException(), showErrors );
return 1;
}
if ( cvr.isGlobalSettingsFilePresent() && !cvr.isGlobalSettingsFileParses() )
{
showFatalError( "Error reading global settings: " + cvr.getGlobalSettingsException().getMessage(), cvr.getGlobalSettingsException(), showErrors );
showError( "Error reading global settings: ", cvr.getGlobalSettingsException(), showErrors );
return 1;
}
@ -375,17 +375,16 @@ public class MavenCli
}
catch ( MavenEmbedderException e )
{
showFatalError( "Unable to start the embedded plexus container", e, showErrors );
showError( "Unable to start the embedder: ", e, showErrors );
return 1;
}
MavenExecutionResult result = mavenEmbedder.execute( request );
if ( result.hasExceptions() )
{
showFatalError( "Unable to configure the Maven application", (Exception) result.getExceptions().get( 0 ), showErrors );
{
showError( (Exception) result.getExceptions().get( 0 ), showErrors );
return 1;
}
@ -393,11 +392,18 @@ public class MavenCli
return 0;
}
private static void showFatalError( String message,
Exception e,
boolean show )
private static void showError( Exception e,
boolean show )
{
System.err.println( "FATAL ERROR: " + message );
showError( e.getMessage(), e, show );
}
private static void showError( String message,
Exception e,
boolean show )
{
System.err.println( message );
if ( show )
{
System.err.println( "Error stacktrace:" );
@ -410,19 +416,6 @@ public class MavenCli
}
}
private static void showError( String message,
Exception e,
boolean show )
{
System.err.println( message );
if ( show )
{
System.err.println( "Error stacktrace:" );
e.printStackTrace();
}
}
private static void showVersion()
{
InputStream resourceAsStream;