[MNG-4922] ExecutionEvent give on the exception encountered (when having mojoFailed) .

Issue id: MNG-4922


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1042189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2010-12-04 14:22:06 +00:00
parent 79f5492d46
commit 6f9be24b14
3 changed files with 32 additions and 0 deletions

View File

@ -1,5 +1,8 @@
package org.apache.maven.execution;
import org.apache.maven.plugin.MojoExecution;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -49,6 +52,10 @@ public interface ExecutionListener
void mojoSucceeded( ExecutionEvent event );
/**
* since 3.0.2 {@link Exception} is in {@link MojoExecution#getException()} returned
* by {@link ExecutionEvent#getMojoExecution()}
*/
void mojoFailed( ExecutionEvent event );
void forkStarted( ExecutionEvent event );

View File

@ -215,6 +215,7 @@ public class MojoExecutor
}
catch ( LifecycleExecutionException e )
{
mojoExecution.setException( new Exception( e.getCause() ) );
eventCatapult.fire( ExecutionEvent.Type.MojoFailed, session, mojoExecution );
throw e;

View File

@ -40,6 +40,11 @@ public class MojoExecution
private Xpp3Dom configuration;
/**
* @since 3.0.2
*/
private Exception exception;
/**
* Describes the source of an execution.
*/
@ -234,4 +239,23 @@ public class MojoExecution
this.forkedExecutions.put( projectKey, forkedExecutions );
}
/**
* @since 3.0.2
* @return {@link Exception} encountered during the execution
*/
public Exception getException()
{
return exception;
}
/**
* @since 3.0.2
* @param exception
*/
public MojoExecution setException( Exception exception )
{
this.exception = exception;
return this;
}
}