From 962b2e233ce5cf3573182b21ac9d769eb710723b Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Wed, 17 Jun 2009 20:37:02 +0000 Subject: [PATCH] [MNG-3012] ClassCastException due to plexus-utils NOT being filtered during plugin loading o Restored fix git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@785783 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/plugin/DefaultPluginManager.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 8b38b90d58..661ef49c79 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 @@ -56,6 +56,7 @@ import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.classworlds.ClassWorld; import org.codehaus.plexus.classworlds.realm.ClassRealm; import org.codehaus.plexus.classworlds.realm.DuplicateRealmException; +import org.codehaus.plexus.classworlds.realm.NoSuchRealmException; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.composition.CycleDetectedInComponentGraphException; @@ -456,6 +457,20 @@ public class DefaultPluginManager { ClassRealm pluginRealm = world.newRealm( realmId ); pluginRealm.setParentRealm( container.getContainerRealm() ); + + String coreRealmId = container.getContainerRealm().getId(); + try + { + pluginRealm.importFrom( coreRealmId, "org.codehaus.plexus.util.xml.Xpp3Dom" ); + pluginRealm.importFrom( coreRealmId, "org.codehaus.plexus.util.xml.pull.XmlPullParser" ); + pluginRealm.importFrom( coreRealmId, "org.codehaus.plexus.util.xml.pull.XmlPullParserException" ); + pluginRealm.importFrom( coreRealmId, "org.codehaus.plexus.util.xml.pull.XmlSerializer" ); + } + catch ( NoSuchRealmException e ) + { + throw new IllegalStateException( e ); + } + return pluginRealm; } catch ( DuplicateRealmException e )