diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java index 98c658b3e2..59da6d3c95 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java @@ -116,6 +116,16 @@ public class DefaultBuildPluginManager throw new PluginExecutionException( mojoExecution, project, os.toString(), e ); } + catch ( ClassCastException e ) + { + ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 ); + PrintStream ps = new PrintStream( os ); + ps.println( "A type incompatibility occured while executing " + mojoDescriptor.getId() ); + ps.println( e ); + pluginRealm.display( ps ); + + throw new PluginExecutionException( mojoExecution, project, os.toString(), e ); + } finally { mavenPluginManager.releaseMojo( mojo, mojoExecution );