PR: MNG-122

fix fail at end

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@320809 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-13 17:05:41 +00:00
parent 11df168337
commit a9f4d9f1e5
2 changed files with 46 additions and 25 deletions

View File

@ -106,27 +106,10 @@ public class DefaultMaven
dispatcher.dispatchStart( event, request.getBaseDirectory() );
ReactorManager rm;
try
{
ReactorManager rm = doExecute( request, dispatcher );
// TODO: shoul all the logging be left to the CLI?
logReactorSummary( rm );
if ( rm.hasBuildFailures() )
{
logErrors( rm, request.isShowErrors() );
}
else
{
logSuccess( rm );
}
stats( request.getStartTime() );
line();
dispatcher.dispatchEnd( event, request.getBaseDirectory() );
rm = doExecute( request, dispatcher );
}
catch ( LifecycleExecutionException e )
{
@ -164,6 +147,43 @@ public class DefaultMaven
throw new MavenExecutionException( "Error executing project within the reactor", t );
}
// Either the build was successful, or it was a fail_at_end/fail_never reactor build
// TODO: should all the logging be left to the CLI?
logReactorSummary( rm );
if ( rm.hasBuildFailures() )
{
logErrors( rm, request.isShowErrors() );
if ( !ReactorManager.FAIL_NEVER.equals( rm.getFailureBehavior() ) )
{
dispatcher.dispatchError( event, request.getBaseDirectory(), null );
getLogger().info( "BUILD ERRORS" );
line();
stats( request.getStartTime() );
line();
throw new MavenExecutionException( "Some builds failed" );
}
else
{
getLogger().info( " + Ignoring failures" );
}
}
logSuccess( rm );
stats( request.getStartTime() );
line();
dispatcher.dispatchEnd( event, request.getBaseDirectory() );
}
private void logErrors( ReactorManager rm, boolean showErrors )
@ -590,7 +610,7 @@ public class DefaultMaven
{
line();
getLogger().info( "FATAL ERROR" );
getLogger().error( "FATAL ERROR" );
line();
@ -603,7 +623,7 @@ public class DefaultMaven
{
line();
getLogger().info( "BUILD ERROR" );
getLogger().error( "BUILD ERROR" );
line();
@ -616,7 +636,7 @@ public class DefaultMaven
{
line();
getLogger().info( "BUILD FAILURE" );
getLogger().error( "BUILD FAILURE" );
line();
@ -636,13 +656,13 @@ public class DefaultMaven
{
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Trace", t );
getLogger().info( "Trace", t );
line();
}
else if ( showErrors )
{
getLogger().error( "Trace", t );
getLogger().info( "Trace", t );
line();
}
@ -665,7 +685,7 @@ public class DefaultMaven
message = t.getMessage();
}
getLogger().error( message );
getLogger().info( message );
line();
}

View File

@ -333,6 +333,7 @@ public class DefaultLifecycleExecutor
{
rm.blackList( project );
}
// if NEVER, don't blacklist
return false;
}