[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
This commit is contained in:
Brett Leslie Porter 2006-02-21 11:22:49 +00:00
parent 8d2478dff6
commit 73ba7305ce
1 changed files with 8 additions and 11 deletions

View File

@ -16,6 +16,7 @@ package org.apache.maven.plugin;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.MavenArtifactFilterManager;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; 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.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; 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.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; 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.project.path.PathTranslator;
import org.apache.maven.reporting.MavenReport; import org.apache.maven.reporting.MavenReport;
import org.apache.maven.settings.Settings; import org.apache.maven.settings.Settings;
import org.apache.maven.MavenArtifactFilterManager;
import org.codehaus.plexus.PlexusConstants; import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusContainerException; 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.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; 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.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom; 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 * @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 * manager which executes before the plugin is instantiated
*/ */
private void checkRequiredMavenVersion( Plugin plugin, ArtifactRepository localRepository, List private void checkRequiredMavenVersion( Plugin plugin, ArtifactRepository localRepository, List remoteRepositories )
remoteRepositories )
throws PluginVersionResolutionException, InvalidPluginException throws PluginVersionResolutionException, InvalidPluginException
{ {
try try
@ -311,8 +308,8 @@ public class DefaultPluginManager
projectPlugin = plugin; projectPlugin = plugin;
} }
Set artifacts = Set artifacts = MavenMetadataSource.createArtifacts( artifactFactory, projectPlugin.getDependencies(), null,
MavenMetadataSource.createArtifacts( artifactFactory, projectPlugin.getDependencies(), null, null, project ); null, project );
// Set artifacts = // Set artifacts =
// MavenMetadataSource.createArtifacts( artifactFactory, plugin.getDependencies(), null, null, project ); // MavenMetadataSource.createArtifacts( artifactFactory, plugin.getDependencies(), null, null, project );
@ -410,7 +407,7 @@ public class DefaultPluginManager
try try
{ {
Thread.currentThread().setContextClassLoader( Thread.currentThread().setContextClassLoader(
new RealmDelegatingClassLoader( mojoDescriptor.getPluginDescriptor().getClassRealm() ) ); mojoDescriptor.getPluginDescriptor().getClassRealm().getClassLoader() );
plugin.execute(); plugin.execute();
@ -614,7 +611,7 @@ public class DefaultPluginManager
artifactMetadataSource, artifactMetadataSource,
artifactFilter ); artifactFilter );
Set resolved = result.getArtifacts(); Set resolved = result.getArtifacts();
for ( Iterator it = resolved.iterator(); it.hasNext(); ) for ( Iterator it = resolved.iterator(); it.hasNext(); )
{ {
@ -1093,7 +1090,7 @@ public class DefaultPluginManager
public void initialize() public void initialize()
{ {
artifactFilter = MavenArtifactFilterManager.createStandardFilter(); artifactFilter = MavenArtifactFilterManager.createStandardFilter();
} }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------