[MNG-2690] DefaultPluginManager.getConfiguredMojo() doesn't handle NoClassDefFoundError correctly

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@801964 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-07 12:16:45 +00:00
parent ae33045c96
commit d24d7049c6
1 changed files with 16 additions and 1 deletions

View File

@ -525,8 +525,23 @@ public class DefaultPluginManager
}
catch ( ComponentLookupException e )
{
Throwable cause = e.getCause();
while ( cause != null && !( cause instanceof LinkageError )
&& !( cause instanceof ClassNotFoundException ) )
{
cause = cause.getCause();
}
if ( ( cause instanceof NoClassDefFoundError ) || ( cause instanceof ClassNotFoundException ) )
{
throw new PluginContainerException( mojoDescriptor, pluginRealm, "Unable to load the mojo '"
+ mojoDescriptor.getGoal() + "' in the plugin '" + pluginDescriptor.getId()
+ "'. A required class is missing: " + cause.getMessage(), e );
}
throw new PluginContainerException( mojoDescriptor, pluginRealm, "Unable to find the mojo '"
+ mojoDescriptor.getGoal() + "' in the plugin '" + pluginDescriptor.getId() + "'", e );
+ mojoDescriptor.getGoal() + "' (or one of its required components) in the plugin '"
+ pluginDescriptor.getId() + "'", e );
}
if ( mojo instanceof ContextEnabled )