[MNG-5208] Parallel (-T option) multi module build fires wrong project failed event

Patch by Stefan Eder , applied with minor modifications
This commit is contained in:
Kristian Rosenvold 2012-12-01 21:30:57 +01:00
parent 327e1b7e80
commit 75ea1e4297
3 changed files with 9 additions and 10 deletions

View File

@ -48,7 +48,7 @@ import java.util.Set;
/** /**
* Common code that is shared by the LifecycleModuleBuilder and the LifeCycleWeaveBuilder * Common code that is shared by the LifecycleModuleBuilder and the LifeCycleWeaveBuilder
* *
* @since 3.0 * @since 3.0
* @author Kristian Rosenvold * @author Kristian Rosenvold
* Builds one or more lifecycles for a full module * Builds one or more lifecycles for a full module
@ -133,9 +133,8 @@ public class BuilderCommon
return executionPlan; return executionPlan;
} }
public void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession, public void handleBuildError(final ReactorContext buildContext, final MavenSession rootSession, final MavenSession currentSession,
final MavenProject mavenProject, Exception e, final long buildStartTime ) final MavenProject mavenProject, Exception e, final long buildStartTime) {
{
if ( e instanceof RuntimeException ) if ( e instanceof RuntimeException )
{ {
e = new InternalErrorException( "Internal error: " + e, e ); e = new InternalErrorException( "Internal error: " + e, e );
@ -147,7 +146,7 @@ public class BuilderCommon
buildContext.getResult().addBuildSummary( new BuildFailure( mavenProject, buildEndTime - buildStartTime, e ) ); buildContext.getResult().addBuildSummary( new BuildFailure( mavenProject, buildEndTime - buildStartTime, e ) );
eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, rootSession, null, e ); eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, currentSession, null, e );
if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( rootSession.getReactorFailureBehavior() ) ) if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( rootSession.getReactorFailureBehavior() ) )
{ {
@ -187,4 +186,4 @@ public class BuilderCommon
} }
} }

View File

@ -32,7 +32,7 @@ import java.util.HashSet;
/** /**
* Builds one or more lifecycles for a full module * Builds one or more lifecycles for a full module
* *
* @since 3.0 * @since 3.0
* @author Benjamin Bentmann * @author Benjamin Bentmann
* @author Jason van Zyl * @author Jason van Zyl
@ -92,7 +92,7 @@ public class LifecycleModuleBuilder
} }
catch ( Exception e ) catch ( Exception e )
{ {
builderCommon.handleBuildError( reactorContext, rootSession, currentProject, e, buildStartTime ); builderCommon.handleBuildError(reactorContext, rootSession, session, currentProject, e, buildStartTime);
} }
finally finally
{ {

View File

@ -277,8 +277,8 @@ public class LifecycleWeaveBuilder
} }
catch ( Exception e ) catch ( Exception e )
{ {
builderCommon.handleBuildError( reactorContext, rootSession, projectBuild.getProject(), e, builderCommon.handleBuildError( reactorContext, rootSession, projectBuild.getSession(),
buildStartTime ); projectBuild.getProject(), e, buildStartTime );
} }
finally finally
{ {