From 17d68dbce5bfd0113a0a8a9afc32b9a332dc52ff Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Wed, 19 Nov 2008 02:31:49 +0000 Subject: [PATCH] o adding some patches for changes in plexus submitted by: Dain Sundstrom git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@718845 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/maven/plugin/DefaultPluginManager.java | 9 +++++++++ .../org/apache/maven/embedder/TestComponentOverride.java | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 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 2d174443cd..7cbb7991a0 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 @@ -813,6 +813,11 @@ public class DefaultPluginManager // lookups that occur in contextualize calls in line with the right realm. container.setLookupRealm( pluginRealm ); + ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader( pluginRealm ); + try + { + getLogger().debug( "Looking up mojo " + mojoDescriptor.getRoleHint() + " in realm " + pluginRealm.getId() + " - descRealmId=" @@ -900,6 +905,10 @@ public class DefaultPluginManager populatePluginFields( mojo, mojoDescriptor, extractedMojoConfiguration, expressionEvaluator ); return mojo; + + } finally { + Thread.currentThread().setContextClassLoader( oldClassLoader ); + } } private void checkDeprecatedParameters( MojoDescriptor mojoDescriptor, diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/TestComponentOverride.java b/maven-embedder/src/test/java/org/apache/maven/embedder/TestComponentOverride.java index 102c2a3c89..3b412ec8a4 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/TestComponentOverride.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/TestComponentOverride.java @@ -66,7 +66,7 @@ public class TestComponentOverride public void testComponentOverride() throws ComponentLookupException { - ArtifactFactory factory = (ArtifactFactory) container.lookup( ArtifactFactory.class ); + ArtifactFactory factory = container.lookup( ArtifactFactory.class ); assertNotNull( factory );