o Properly handled linkage errors during mojo execution

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@814890 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-09-14 22:28:01 +00:00
parent 0553645ac6
commit 588907b593
2 changed files with 14 additions and 2 deletions

View File

@ -15,6 +15,8 @@ package org.apache.maven.plugin;
* the License.
*/
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
@ -113,9 +115,13 @@ public class DefaultBuildPluginManager
}
catch ( LinkageError e )
{
pluginRealm.display();
ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
PrintStream ps = new PrintStream( os );
ps.println( "A linkage error occured while executing " + mojoDescriptor.getId() );
ps.println( e );
pluginRealm.display( ps );
throw e;
throw new PluginExecutionException( mojoExecution, project, os.toString(), e );
}
finally
{

View File

@ -34,6 +34,12 @@ public class PluginExecutionException
this.mojoExecution = mojoExecution;
}
public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, String message, Throwable cause )
{
super( mojoExecution.getMojoDescriptor(), project, message, cause );
this.mojoExecution = mojoExecution;
}
public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, Exception cause )
{
super( mojoExecution.getMojoDescriptor(), project, constructMessage( cause ), cause );