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 aa3d0b84fa..ab50dea925 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 @@ -581,8 +581,8 @@ public class DefaultPluginManager if ( getLogger().isFatalErrorEnabled() ) { getLogger().fatalError( - mojo.getClass().getName() + "#execute() caused a linkage error " - + "and may be out-of-date. Check the realms:" ); + mojo.getClass().getName() + "#execute() caused a linkage error (" + + e.getClass().getName() + ") and may be out-of-date. Check the realms:" ); StringBuffer sb = new StringBuffer(); sb.append( "Plugin realm = " + pluginRealm.getId() ).append( '\n' ); @@ -1290,6 +1290,46 @@ public class DefaultPluginManager "Unable to retrieve component configurator for plugin configuration", e ); } + catch ( LinkageError e ) + { + if ( getLogger().isFatalErrorEnabled() ) + { + getLogger().fatalError( + configurator.getClass().getName() + "#configureComponent(...) caused a linkage error (" + + e.getClass().getName() + ") and may be out-of-date. Check the realms:" ); + + ClassRealm pluginRealm = mojoDescriptor.getPluginDescriptor().getClassRealm(); + StringBuffer sb = new StringBuffer(); + sb.append( "Plugin realm = " + pluginRealm.getId() ).append( '\n' ); + for ( int i = 0; i < pluginRealm.getURLs().length; i++ ) + { + sb.append( "urls[" + i + "] = " + pluginRealm.getURLs()[i] ); + if ( i != ( pluginRealm.getURLs().length - 1 ) ) + { + sb.append( '\n' ); + } + } + getLogger().fatalError( sb.toString() ); + + ClassRealm containerRealm = container.getContainerRealm(); + sb = new StringBuffer(); + sb.append( "Container realm = " + containerRealm.getId() ).append( '\n' ); + for ( int i = 0; i < containerRealm.getURLs().length; i++ ) + { + sb.append( "urls[" + i + "] = " + containerRealm.getURLs()[i] ); + if ( i != ( containerRealm.getURLs().length - 1 ) ) + { + sb.append( '\n' ); + } + } + getLogger().fatalError( sb.toString() ); + } + + throw new PluginConfigurationException( + mojoDescriptor.getPluginDescriptor(), + e.getClass().getName() + ": " + e.getMessage(), + new ComponentConfigurationException( e ) ); + } finally { if ( configurator != null )