From d24d7049c661fbd74b779e6ded212a411955ae51 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 7 Aug 2009 12:16:45 +0000 Subject: [PATCH] [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 --- .../maven/plugin/DefaultPluginManager.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index 9c3aa5b008..292e871ddb 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -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 )