From 73ba7305ce6b5957a22397c02e05b99f3c4b49cf Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Tue, 21 Feb 2006 11:22:49 +0000 Subject: [PATCH] [MNG-1898] get rid of RealmDelegatingClassLoader, use the RealmClassLoader. Works with test case on MNG-1898 and MNG-1804. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@379425 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/plugin/DefaultPluginManager.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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 3d6f3e7bef..a756d6b730 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 @@ -16,6 +16,7 @@ package org.apache.maven.plugin; * limitations under the License. */ +import org.apache.maven.MavenArtifactFilterManager; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; @@ -27,7 +28,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter; import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; @@ -55,7 +55,6 @@ import org.apache.maven.project.artifact.MavenMetadataSource; import org.apache.maven.project.path.PathTranslator; import org.apache.maven.reporting.MavenReport; import org.apache.maven.settings.Settings; -import org.apache.maven.MavenArtifactFilterManager; import org.codehaus.plexus.PlexusConstants; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainerException; @@ -73,7 +72,6 @@ import org.codehaus.plexus.context.ContextException; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; -import org.codehaus.classworlds.RealmDelegatingClassLoader; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.Xpp3Dom; @@ -241,8 +239,7 @@ public class DefaultPluginManager * @todo would be better to store this in the plugin descriptor, but then it won't be available to the version * manager which executes before the plugin is instantiated */ - private void checkRequiredMavenVersion( Plugin plugin, ArtifactRepository localRepository, List - remoteRepositories ) + private void checkRequiredMavenVersion( Plugin plugin, ArtifactRepository localRepository, List remoteRepositories ) throws PluginVersionResolutionException, InvalidPluginException { try @@ -311,8 +308,8 @@ public class DefaultPluginManager projectPlugin = plugin; } - Set artifacts = - MavenMetadataSource.createArtifacts( artifactFactory, projectPlugin.getDependencies(), null, null, project ); + Set artifacts = MavenMetadataSource.createArtifacts( artifactFactory, projectPlugin.getDependencies(), null, + null, project ); // Set artifacts = // MavenMetadataSource.createArtifacts( artifactFactory, plugin.getDependencies(), null, null, project ); @@ -410,7 +407,7 @@ public class DefaultPluginManager try { Thread.currentThread().setContextClassLoader( - new RealmDelegatingClassLoader( mojoDescriptor.getPluginDescriptor().getClassRealm() ) ); + mojoDescriptor.getPluginDescriptor().getClassRealm().getClassLoader() ); plugin.execute(); @@ -607,14 +604,14 @@ public class DefaultPluginManager Set dependencies = new HashSet( resolutionGroup.getArtifacts() ); dependencies.addAll( pluginDescriptor.getIntroducedDependencyArtifacts() ); - + ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, pluginArtifact, localRepository, resolutionGroup.getResolutionRepositories(), artifactMetadataSource, artifactFilter ); - Set resolved = result.getArtifacts(); + Set resolved = result.getArtifacts(); for ( Iterator it = resolved.iterator(); it.hasNext(); ) { @@ -1093,7 +1090,7 @@ public class DefaultPluginManager public void initialize() { - artifactFilter = MavenArtifactFilterManager.createStandardFilter(); + artifactFilter = MavenArtifactFilterManager.createStandardFilter(); } // ----------------------------------------------------------------------