diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/Configuration.java b/maven-embedder/src/main/java/org/apache/maven/embedder/Configuration.java index 1bb1a48555..2b6a499d4d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/Configuration.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/Configuration.java @@ -18,6 +18,7 @@ package org.apache.maven.embedder; * under the License. */ +import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.classworlds.ClassWorld; import java.io.File; @@ -76,6 +77,10 @@ public interface Configuration Configuration setClassLoader( ClassLoader loader ); + PlexusContainer getParentContainer(); + + Configuration setParentContainer( PlexusContainer parentContainer ); + // ---------------------------------------------------------------------------- // Profiles // ---------------------------------------------------------------------------- @@ -120,5 +125,5 @@ public interface Configuration void addExtension( URL url ); - List getExtensions(); + List getExtensions(); } diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfiguration.java index a65b4082ee..cf878a4a40 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfiguration.java @@ -18,6 +18,7 @@ package org.apache.maven.embedder; * under the License. */ +import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.classworlds.ClassWorld; import java.io.File; @@ -53,6 +54,8 @@ public class DefaultConfiguration private ClassWorld classWorld; + private PlexusContainer parentContainer; + private File localRepository; /** Creates a new instance of DefaultConfiguration */ @@ -189,6 +192,17 @@ public class DefaultConfiguration return this; } + public PlexusContainer getParentContainer() + { + return parentContainer; + } + + public Configuration setParentContainer( PlexusContainer parentContainer ) + { + this.parentContainer = parentContainer; + return this; + } + // ---------------------------------------------------------------------------- // Local Repository // ---------------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java index 1df4e32ebd..665f5dfc54 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java @@ -494,17 +494,17 @@ public class MavenEmbedder { return getBuildLifecyclePhases(); } - + public List getAllLifecyclePhases() { return LifecycleUtils.getValidPhaseNames(); } - + public List getDefaultLifecyclePhases() { return getBuildLifecyclePhases(); } - + public List getBuildLifecyclePhases() { return LifecycleUtils.getValidBuildPhaseNames(); @@ -557,7 +557,7 @@ public class MavenEmbedder try { ContainerConfiguration cc = new DefaultContainerConfiguration() - .setClassWorld( classWorld ); + .setClassWorld( classWorld ).setParentContainer( configuration.getParentContainer() ); container = new DefaultPlexusContainer( cc ); } @@ -918,7 +918,7 @@ public class MavenEmbedder /** * Return the instance of the plexus container being used in the embedder. - * + * * @return The plexus container used in the embedder. */ public PlexusContainer getPlexusContainer()