Author: bentmann
Date: Fri Aug 7 15:15:45 2009
New Revision: 802041
URL: http://svn.apache.org/viewvc?rev=802041&view=rev
Log:
[MNG-4273] [regression] Internal utility classes of core leak into plugin realm
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
maven/components/trunk/pom.xml
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
URL:
http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java?rev=802041&r1=802040&r2=802041&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
Fri Aug 7 15:15:45 2009
@@ -29,7 +29,6 @@
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.logging.Logger;
@@ -88,120 +87,67 @@
}
}
- classRealm.setParentRealm( getApiRealm() );
+ classRealm.setParentRealm( container.getContainerRealm() );
importXpp3Dom( classRealm );
+ importMavenApi( classRealm );
+
return classRealm;
}
}
/**
- * Gets the class realm that holds the Maven API classes that we intend to
share with plugins and extensions. The
- * API realm is basically a subset of the core realm and hides internal
utility/implementation classes from
- * plugins/extensions.
+ * Imports Xpp3Dom and associated types into the specified realm. Unlike
the other archives that constitute the API
+ * realm, plexus-utils is not excluded from the plugin/project realm, yet
we must ensure this class is loaded from
+ * the API realm and not from the plugin/project realm.
*
- * @return The class realm for the Maven API, never {...@code null}.
+ * @param importingRealm The realm into which to import Xpp3Dom, must not
be {...@code null}.
*/
- private ClassRealm getApiRealm()
+ private void importXpp3Dom( ClassRealm importingRealm )
{
- return container.getContainerRealm();
+ ClassRealm coreRealm = container.getContainerRealm();
-// TODO: MNG-4273, currently non-functional because the core artifact filter
wipes out transitive plugin dependencies
-// like plexus-utils, too. We need to filter the result set of the
plugin artifacts, not the graph.
-//
-// ClassWorld world = getClassWorld();
-//
-// String realmId = "maven.api";
-//
-// ClassRealm apiRealm;
-//
-// synchronized ( world )
-// {
-// apiRealm = world.getClassRealm( realmId );
-//
-// if ( apiRealm == null )
-// {
-// try
-// {
-// apiRealm = world.newRealm( realmId );
-// }
-// catch ( DuplicateRealmException e )
-// {
-// throw new IllegalStateException( "Failed to create API
realm " + realmId, e );
-// }
-//
-// String coreRealmId = container.getContainerRealm().getId();
-// try
-// {
-// // components.xml
-// apiRealm.importFrom( coreRealmId, "META-INF/plexus" );
-//
-// // maven-*
-// apiRealm.importFrom( coreRealmId, "org.apache.maven." );
-//
-// // plexus-classworlds
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.classworlds" );
-//
-// // plexus-container, plexus-component-annotations
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.component" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.configuration" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.container" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.context" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.lifecycle" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.logging" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.personality" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.ComponentRegistry" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.ContainerConfiguration" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.DefaultComponentRegistry" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.DefaultContainerConfiguration" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.DefaultPlexusContainer" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.DuplicateChildContainerException" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.MutablePlexusContainer" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.PlexusConstants" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.PlexusContainer" );
-// apiRealm.importFrom( coreRealmId,
"org.codehaus.plexus.PlexusContainerException" );
-// }
-// catch ( NoSuchRealmException e )
-// {
-// throw new IllegalStateException( e );
-// }
-//
-// try
-// {
-// container.discoverComponents( apiRealm );
-// }
-// catch ( Exception e )
-// {
-// throw new IllegalStateException( "Failed to discover
components in API realm " + realmId, e );
-// }
-// }
-// }
-//
-// return apiRealm;
+ importingRealm.importFrom( coreRealm,
"org.codehaus.plexus.util.xml.Xpp3Dom" );
+ importingRealm.importFrom( coreRealm,
"org.codehaus.plexus.util.xml.pull.XmlPullParser" );
+ importingRealm.importFrom( coreRealm,
"org.codehaus.plexus.util.xml.pull.XmlPullParserException" );
+ importingRealm.importFrom( coreRealm,
"org.codehaus.plexus.util.xml.pull.XmlSerializer" );
}
/**
- * Imports Xpp3Dom and associated types into the specified realm. Unlike
the other archives that constitute the API
- * realm, plexus-utils is not excluded from the plugin/project realm, yet
we must ensure this class is loaded from
- * the API realm and not from the plugin/project realm.
+ * Imports the classes/resources constituting the Maven API into the
specified realm.
*
- * @param importingRealm The realm into which to import Xpp3Dom, must not
be {...@code null}.
+ * @param importingRealm The realm into which to import the Maven API,
must not be {...@code null}.
*/
- private void importXpp3Dom( ClassRealm importingRealm )
+ private void importMavenApi( ClassRealm importingRealm )
{
- String coreRealmId = container.getContainerRealm().getId();
- try
- {
- importingRealm.importFrom( coreRealmId,
"org.codehaus.plexus.util.xml.Xpp3Dom" );
- importingRealm.importFrom( coreRealmId,
"org.codehaus.plexus.util.xml.pull.XmlPullParser" );
- importingRealm.importFrom( coreRealmId,
"org.codehaus.plexus.util.xml.pull.XmlPullParserException" );
- importingRealm.importFrom( coreRealmId,
"org.codehaus.plexus.util.xml.pull.XmlSerializer" );
- }
- catch ( NoSuchRealmException e )
- {
- throw new IllegalStateException( e );
- }
+ // components.xml
+ importingRealm.importFromParent( "META-INF/plexus" );
+
+ // maven-*
+ importingRealm.importFromParent( "org.apache.maven" );
+
+ // plexus-classworlds
+ importingRealm.importFromParent( "org.codehaus.plexus.classworlds" );
+
+ // plexus-container, plexus-component-annotations
+ importingRealm.importFromParent( "org.codehaus.plexus.component" );
+ importingRealm.importFromParent( "org.codehaus.plexus.configuration" );
+ importingRealm.importFromParent( "org.codehaus.plexus.container" );
+ importingRealm.importFromParent( "org.codehaus.plexus.context" );
+ importingRealm.importFromParent( "org.codehaus.plexus.lifecycle" );
+ importingRealm.importFromParent( "org.codehaus.plexus.logging" );
+ importingRealm.importFromParent( "org.codehaus.plexus.personality" );
+ importingRealm.importFromParent(
"org.codehaus.plexus.ComponentRegistry" );
+ importingRealm.importFromParent(
"org.codehaus.plexus.ContainerConfiguration" );
+ importingRealm.importFromParent(
"org.codehaus.plexus.DefaultComponentRegistry" );
+ importingRealm.importFromParent(
"org.codehaus.plexus.DefaultContainerConfiguration" );
+ importingRealm.importFromParent(
"org.codehaus.plexus.DefaultPlexusContainer" );
+ importingRealm.importFromParent(
"org.codehaus.plexus.DuplicateChildContainerException" );
+ importingRealm.importFromParent(
"org.codehaus.plexus.MutablePlexusContainer" );
+ importingRealm.importFromParent( "org.codehaus.plexus.PlexusConstants"
);
+ importingRealm.importFromParent( "org.codehaus.plexus.PlexusContainer"
);
+ importingRealm.importFromParent(
"org.codehaus.plexus.PlexusContainerException" );
}
public ClassRealm createProjectRealm( Model model )
Modified: maven/components/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/maven/components/trunk/pom.xml?rev=802041&r1=802040&r2=802041&view=diff
==============================================================================
--- maven/components/trunk/pom.xml (original)
+++ maven/components/trunk/pom.xml Fri Aug 7 15:15:45 2009
@@ -38,11 +38,11 @@
<inceptionYear>2001</inceptionYear>
<properties>
- <classWorldsVersion>1.5.0</classWorldsVersion>
+ <classWorldsVersion>2.0.0</classWorldsVersion>
<commonsCliVersion>1.2</commonsCliVersion>
<easyMockVersion>1.2_Java1.3</easyMockVersion>
<junitVersion>3.8.2</junitVersion>
- <plexusVersion>1.0.0</plexusVersion>
+ <plexusVersion>1.1.0</plexusVersion>
<plexusInterpolationVersion>1.11</plexusInterpolationVersion>
<plexusPluginManagerVersion>1.0-alpha-1</plexusPluginManagerVersion>
<plexusUtilsVersion>1.5.15</plexusUtilsVersion>