mirror of https://github.com/apache/maven.git
Merge maven.new for latest plexus classworlds and container APIs
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@483302 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a6977b53c7
commit
44ae99fc2d
Binary file not shown.
107
build.xml
107
build.xml
|
@ -14,6 +14,12 @@
|
|||
local repository for the bootstrap process.
|
||||
</description>
|
||||
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
||||
<classpath>
|
||||
<pathelement path="ant-contrib-1.0b2.jar"/>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<target name="isMavenHomeSet">
|
||||
<property environment="env"/>
|
||||
<condition property="maven.home" value="${env.M2_HOME}">
|
||||
|
@ -88,17 +94,15 @@
|
|||
</antcall>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<pull orgpath="org/codehaus/plexus/plexus-utils" version="1.1" name="plexus-utils"/>
|
||||
<pull orgpath="org/codehaus/plexus/plexus-container-default" version="1.0-alpha-9" name="plexus-container-default"/>
|
||||
<pull orgpath="commons-cli/commons-cli" version="1.0" name="commons-cli"/>
|
||||
<pull orgpath="org/apache/maven/wagon/wagon-provider-api" version="1.0-beta-1" name="wagon-provider-api"/>
|
||||
<pull orgpath="classworlds/classworlds" version="1.1-alpha-2" name="classworlds"/>
|
||||
<pull orgpath="org/codehaus/plexus/plexus-utils" version="1.1" name="plexus-utils"/>
|
||||
<pull orgpath="org/codehaus/plexus/plexus-container-default" version="1.0-alpha-12" name="plexus-container-default"/>
|
||||
<pull orgpath="org/codehaus/plexus/plexus-component-api" version="1.0-alpha-12" name="plexus-component-api"/>
|
||||
<pull orgpath="org/codehaus/plexus/plexus-classworlds" version="1.2-alpha-5" name="plexus-classworlds"/>
|
||||
<pull orgpath="org/codehaus/plexus/plexus-interactivity-api" version="1.0-alpha-4" name="plexus-interactivity-api"/>
|
||||
|
||||
<pull orgpath="org/codehaus/plexus/plexus-archiver" version="1.0-alpha-8-SNAPSHOT"
|
||||
name="plexus-archiver" repository="codehaus"/>
|
||||
|
||||
<pull orgpath="org/codehaus/plexus/plexus-archiver" version="1.0-alpha-8-SNAPSHOT" name="plexus-archiver" repository="codehaus"/>
|
||||
<pull orgpath="org/apache/apache" version="3" name="apache" type="pom"/>
|
||||
<pull orgpath="org/apache/maven/wagon/wagon-provider-api" version="1.0-beta-1" name="wagon-provider-api"/>
|
||||
<pull orgpath="org/apache/maven/maven-parent" version="4" name="maven-parent" type="pom"/>
|
||||
<pull orgpath="org/apache/maven/plugins/maven-plugins" version="4-SNAPSHOT" name="maven-plugins" type="pom"/>
|
||||
<pull orgpath="org/apache/maven/wagon/wagon-file" version="1.0-alpha-7" name="wagon-file"/>
|
||||
|
@ -107,36 +111,40 @@
|
|||
<pull orgpath="org/apache/maven/wagon/wagon-ssh-external" version="1.0-alpha-6" name="wagon-ssh-external"/>
|
||||
<pull orgpath="org/apache/maven/wagon/wagon-ssh" version="1.0-alpha-7" name="wagon-ssh"/>
|
||||
<pull orgpath="org/apache/maven/doxia/doxia-sink-api" version="1.0-alpha-9-SNAPSHOT" name="doxia-sink-api"/>
|
||||
<pull orgpath="org/codehaus/modello/modello-core" version="1.0-alpha-7" name="modello-core"/>
|
||||
<pull orgpath="org/codehaus/modello/modello-plugin-xml" version="1.0-alpha-8" name="modello-plugin-xml"/>
|
||||
<pull orgpath="org/codehaus/modello/modello-plugin-xpp3" version="1.0-alpha-8" name="modello-plugin-xpp3"/>
|
||||
<pull orgpath="org/codehaus/modello/modello-core" version="1.0-alpha-12-SNAPSHOT" name="modello-core"/>
|
||||
<pull orgpath="org/codehaus/modello/modello-plugin-xml" version="1.0-alpha-12-SNAPSHOT" name="modello-plugin-xml"/>
|
||||
<pull orgpath="org/codehaus/modello/modello-plugin-xpp3" version="1.0-alpha-12-SNAPSHOT" name="modello-plugin-xpp3"/>
|
||||
<pull orgpath="junit/junit" version="3.8.1" name="junit"/>
|
||||
</target>
|
||||
|
||||
<target name="classpath-pre" depends="init,pull"
|
||||
description="constructs a classpath reference containing our dependencies, and verifies that all files are present">
|
||||
<path id="pre.classpath">
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar"/>
|
||||
<pathelement location="${maven.repo.local}/junit/junit/3.8.1/junit-3.8.1.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-container-default/1.0-alpha-9/plexus-container-default-1.0-alpha-9.jar"/>
|
||||
<pathelement location="${maven.repo.local}/commons-cli/commons-cli/1.0/commons-cli-1.0.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/apache/maven/wagon/wagon-provider-api/1.0-beta-1/wagon-provider-api-1.0-beta-1.jar"/>
|
||||
<pathelement location="${maven.repo.local}/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-container-default/1.0-alpha-12/plexus-container-default-1.0-alpha-12.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-component-api/1.0-alpha-12/plexus-component-api-1.0-alpha-12.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-classworlds/1.2-alpha-5-SNAPSHOT/plexus-classworlds-1.2-alpha-5-SNAPSHOT.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/apache/maven/wagon/wagon-file/1.0-alpha-7/wagon-file-1.0-alpha-7.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/apache/maven/wagon/wagon-provider-api/1.0-beta-1/wagon-provider-api-1.0-beta-1.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/apache/maven/wagon/wagon-http-lightweight/1.0-alpha-6/wagon-http-lightweight-1.0-alpha-6.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/apache/maven/wagon/wagon-provider-api/1.0-beta-1/wagon-provider-api-1.0-beta-1.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/apache/maven/wagon/wagon-ssh-external/1.0-alpha-6/wagon-ssh-external-1.0-alpha-6.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/apache/maven/wagon/wagon-ssh/1.0-alpha-7/wagon-ssh-1.0-alpha-7.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-9-SNAPSHOT/doxia-sink-api-1.0-alpha-9-SNAPSHOT.jar"/>
|
||||
<pathelement location="${maven.repo.local}/junit/junit/3.8.1/junit-3.8.1.jar"/>
|
||||
</path>
|
||||
<!-- DGF Need to keep these modello classes out of the system classpath at runtime, because different parts of the build
|
||||
need different versions of modello. -->
|
||||
<path id="modello.classpath">
|
||||
<path refid="pre.classpath"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/modello/modello-core/1.0-alpha-7/modello-core-1.0-alpha-7.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/modello/modello-plugin-xml/1.0-alpha-8/modello-plugin-xml-1.0-alpha-8.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/modello/modello-plugin-xpp3/1.0-alpha-8/modello-plugin-xpp3-1.0-alpha-8.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/modello/modello-core/1.0-alpha-12-SNAPSHOT/modello-core-1.0-alpha-12-SNAPSHOT.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/modello/modello-plugin-xml/1.0-alpha-12-SNAPSHOT/modello-plugin-xml-1.0-alpha-12-SNAPSHOT.jar"/>
|
||||
<pathelement location="${maven.repo.local}/org/codehaus/modello/modello-plugin-xpp3/1.0-alpha-12-SNAPSHOT/modello-plugin-xpp3-1.0-alpha-12-SNAPSHOT.jar"/>
|
||||
<!--
|
||||
<pathelement location="modello.jar"/>
|
||||
-->
|
||||
</path>
|
||||
<!-- DGF pathconvert immediately so we can validate the classpath -->
|
||||
<pathconvert property="pre.classpath.str" refid="pre.classpath" pathsep="
"/>
|
||||
|
@ -154,7 +162,7 @@
|
|||
<attribute name="mode"/>
|
||||
<attribute name="version"/>
|
||||
<sequential>
|
||||
<java fork="false" classname="org.codehaus.modello.ModelloCli" failonerror="true">
|
||||
<java fork="fork" classname="org.codehaus.modello.ModelloCli" failonerror="true">
|
||||
<classpath refid="modello.classpath"/>
|
||||
<arg file="@{file}"/>
|
||||
<arg value="@{mode}"/>
|
||||
|
@ -224,10 +232,10 @@
|
|||
<arg value="-e"/>
|
||||
<arg value="-B"/>
|
||||
<arg value="-X"/>
|
||||
<!-- JDC: Commenting out offline mode until all plugins and their dependencies
|
||||
can be pre-resolved before this call.
|
||||
<arg value="-o"/>
|
||||
-->
|
||||
<!-- JDC: Commenting out offline mode until all plugins and their dependencies
|
||||
can be pre-resolved before this call.
|
||||
<arg value="-o"/>
|
||||
-->
|
||||
<arg value="clean"/>
|
||||
<arg value="install"/>
|
||||
</java>
|
||||
|
@ -241,9 +249,9 @@
|
|||
<arg value="-e"/>
|
||||
<arg value="-B"/>
|
||||
|
||||
<!-- JDC: Removing offline switch until we can pre-resolve all plugins, dependencies and associated POMs.
|
||||
<arg value="-o"/>
|
||||
-->
|
||||
<!-- JDC: Removing offline switch until we can pre-resolve all plugins, dependencies and associated POMs.
|
||||
<arg value="-o"/>
|
||||
-->
|
||||
<arg value="clean"/>
|
||||
<arg value="assembly:assembly"/>
|
||||
</java>
|
||||
|
@ -253,11 +261,13 @@
|
|||
<available file="${maven.assembly}"/>
|
||||
</not>
|
||||
</condition>
|
||||
<fail if="build.failed" message="Assembly task seemed to succeed, but couldn't find assembly file: ${maven.assembly}"/>
|
||||
<fail if="build.failed"
|
||||
message="Assembly task seemed to succeed, but couldn't find assembly file: ${maven.assembly}"/>
|
||||
</target>
|
||||
|
||||
<target name="extract-assembly" depends="init,maven-assembly"
|
||||
description="extracts the maven assembly into maven.home">
|
||||
<echo>Extracting assembly to ${maven.home.dirname} ...</echo>
|
||||
<delete dir="${maven.home}"/>
|
||||
<unzip src="${maven.assembly}" dest="${maven.home.dirname}"/>
|
||||
<chmod perm="+x">
|
||||
|
@ -340,21 +350,38 @@
|
|||
<!-- Replace 'SNAPSHOT' with 'timestamp-buildnumber'. This is ugly but
|
||||
ant doesn't allow updating of properties.
|
||||
-->
|
||||
<xmlproperty file="${maven.repo.local}/${orgpath}/${version}/bootstrap-maven-metadata.xml"/>
|
||||
<echo file="deleteme.version.properties" message="${version}"/>
|
||||
<replaceregexp file="deleteme.version.properties"
|
||||
match="SNAPSHOT"
|
||||
replace="${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}"
|
||||
byline="true"/>
|
||||
<loadfile srcFile="deleteme.version.properties" property="fileversion"/>
|
||||
|
||||
<condition property="localSnapshot" value="false">
|
||||
<not>
|
||||
<available file="${maven.repo.local}/${orgpath}/${version}/maven-metadata-local.xml"/>
|
||||
</not>
|
||||
</condition>
|
||||
|
||||
<if>
|
||||
<equals arg1="${localSnapshot}" arg2="false"/>
|
||||
<then>
|
||||
<xmlproperty file="${maven.repo.local}/${orgpath}/${version}/bootstrap-maven-metadata.xml"/>
|
||||
<echo file="deleteme.version.properties" message="${version}"/>
|
||||
<replaceregexp file="deleteme.version.properties"
|
||||
match="SNAPSHOT"
|
||||
replace="${metadata.versioning.snapshot.timestamp}-${metadata.versioning.snapshot.buildNumber}"
|
||||
byline="true"/>
|
||||
<loadfile srcFile="deleteme.version.properties" property="fileversion"/>
|
||||
|
||||
<!-- download the final artifact -->
|
||||
<get src="${repo}/${orgpath}/${version}/${name}-${fileversion}.${type}"
|
||||
dest="${maven.repo.local}/${orgpath}/${version}/${name}-${version}.${type}" usetimestamp="true"
|
||||
ignoreerrors="false"
|
||||
/>
|
||||
</then>
|
||||
<else>
|
||||
<property name="fileversion" value="SNAPSHOT"/>
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<echo>Resolved version ${fileversion} (given=${version})</echo>
|
||||
|
||||
<!-- download the final artifact -->
|
||||
<get src="${repo}/${orgpath}/${version}/${name}-${fileversion}.${type}"
|
||||
dest="${maven.repo.local}/${orgpath}/${version}/${name}-${version}.${type}" usetimestamp="true"
|
||||
ignoreerrors="false"
|
||||
/>
|
||||
|
||||
<condition property="build.failed">
|
||||
<not>
|
||||
<available file="${maven.repo.local}/${orgpath}/${version}/${name}-${version}.${type}"/>
|
||||
|
|
|
@ -35,12 +35,13 @@ import org.apache.maven.usability.diagnostics.ErrorDiagnostics;
|
|||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.Task;
|
||||
import org.codehaus.classworlds.ClassWorld;
|
||||
import org.codehaus.classworlds.DuplicateRealmException;
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
|
||||
import org.codehaus.plexus.PlexusContainerException;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.DefaultPlexusContainer;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.embed.Embedder;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
@ -60,7 +61,7 @@ public abstract class AbstractArtifactTask
|
|||
{
|
||||
private Settings settings;
|
||||
|
||||
private Embedder embedder;
|
||||
private PlexusContainer container;
|
||||
|
||||
private Pom pom;
|
||||
|
||||
|
@ -120,7 +121,7 @@ public abstract class AbstractArtifactTask
|
|||
{
|
||||
try
|
||||
{
|
||||
getEmbedder().release( repositoryFactory );
|
||||
getContainer().release( repositoryFactory );
|
||||
}
|
||||
catch ( ComponentLifecycleException e )
|
||||
{
|
||||
|
@ -261,7 +262,7 @@ public abstract class AbstractArtifactTask
|
|||
{
|
||||
try
|
||||
{
|
||||
return getEmbedder().lookup( role );
|
||||
return getContainer().lookup( role );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
|
@ -273,7 +274,7 @@ public abstract class AbstractArtifactTask
|
|||
{
|
||||
try
|
||||
{
|
||||
return getEmbedder().lookup( role, roleHint );
|
||||
return getContainer().lookup( role, roleHint );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
|
@ -293,23 +294,22 @@ public abstract class AbstractArtifactTask
|
|||
return remoteRepository;
|
||||
}
|
||||
|
||||
protected synchronized Embedder getEmbedder()
|
||||
protected synchronized PlexusContainer getContainer()
|
||||
{
|
||||
if ( embedder == null )
|
||||
if ( container == null )
|
||||
{
|
||||
embedder = (Embedder) getProject().getReference( Embedder.class.getName() );
|
||||
container = (PlexusContainer) getProject().getReference( PlexusContainer.class.getName() );
|
||||
|
||||
if ( embedder == null )
|
||||
if ( container == null )
|
||||
{
|
||||
embedder = new Embedder();
|
||||
|
||||
try
|
||||
{
|
||||
ClassWorld classWorld = new ClassWorld();
|
||||
|
||||
classWorld.newRealm( "plexus.core", getClass().getClassLoader() );
|
||||
|
||||
embedder.start( classWorld );
|
||||
container = new DefaultPlexusContainer( null, null, null, classWorld );
|
||||
|
||||
}
|
||||
catch ( PlexusContainerException e )
|
||||
{
|
||||
|
@ -320,10 +320,11 @@ public abstract class AbstractArtifactTask
|
|||
throw new BuildException( "Unable to create embedder ClassRealm", e );
|
||||
}
|
||||
|
||||
getProject().addReference( Embedder.class.getName(), embedder );
|
||||
getProject().addReference( PlexusContainer.class.getName(),container );
|
||||
}
|
||||
}
|
||||
return embedder;
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
public Pom buildPom( MavenProjectBuilder projectBuilder, ArtifactRepository localArtifactRepository )
|
||||
|
@ -372,7 +373,7 @@ public abstract class AbstractArtifactTask
|
|||
{
|
||||
try
|
||||
{
|
||||
ErrorDiagnostics diagnostics = (ErrorDiagnostics) embedder.lookup( ErrorDiagnostics.ROLE );
|
||||
ErrorDiagnostics diagnostics = (ErrorDiagnostics) container.lookup( ErrorDiagnostics.ROLE );
|
||||
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
|
|
|
@ -118,7 +118,8 @@ public class InstallWagonProviderTask
|
|||
for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
|
||||
{
|
||||
Artifact a = (Artifact) i.next();
|
||||
getEmbedder().getContainer().addJarResource( a.getFile() );
|
||||
|
||||
getContainer().addJarResource( a.getFile() );
|
||||
}
|
||||
}
|
||||
catch ( PlexusContainerException e )
|
||||
|
|
|
@ -39,14 +39,12 @@
|
|||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>classworlds</groupId>
|
||||
<artifactId>classworlds</artifactId>
|
||||
<version>1.1</version>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-classworlds</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
<outputDirectory>conf</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<!-- TODO: use expressions instead: ${project.build.directory}, ${project.build.finalName}, or have a <build /> tag to include the built artifact -->
|
||||
<directory>target</directory>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<includes>
|
||||
|
@ -53,22 +52,25 @@
|
|||
<outputDirectory>core</outputDirectory>
|
||||
<includes>
|
||||
<include>org.codehaus.plexus:plexus-container-default</include>
|
||||
<include>org.codehaus.plexus:plexus-component-api</include>
|
||||
<include>org.codehaus.plexus:plexus-utils</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
<dependencySet>
|
||||
<outputDirectory>core/boot</outputDirectory>
|
||||
<includes>
|
||||
<include>classworlds:classworlds</include>
|
||||
<include>org.codehaus.plexus:plexus-classworlds</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<excludes>
|
||||
<!-- Where is this coming from -->
|
||||
<exclude>classworlds:classworlds</exclude>
|
||||
<exclude>org.codehaus.plexus:plexus-container-default</exclude>
|
||||
<exclude>classworlds:classworlds</exclude>
|
||||
<exclude>org.codehaus.plexus:plexus-component-api</exclude>
|
||||
<exclude>org.codehaus.plexus:plexus-classworlds</exclude>
|
||||
<exclude>org.codehaus.plexus:plexus-utils</exclude>
|
||||
<!-- transitively picked up via default container - not needed -->
|
||||
<exclude>plexus:plexus-utils</exclude>
|
||||
<exclude>junit:junit</exclude>
|
||||
</excludes>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
main is org.apache.maven.cli.MavenCli from plexus.core.maven
|
||||
main is org.apache.maven.cli.MavenCli from plexus.core
|
||||
|
||||
set maven.home default ${user.home}/m2
|
||||
|
||||
[plexus.core]
|
||||
load ${maven.home}/core/*.jar
|
||||
|
||||
[plexus.core.maven]
|
||||
load ${maven.home}/lib/*.jar
|
||||
#[plexus.core.maven]
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ if [ -z "$JAVA_HOME" ] ; then
|
|||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.classworlds.Launcher
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
|
@ -157,7 +157,7 @@ fi
|
|||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
-classpath "${M2_HOME}"/core/boot/classworlds-*.jar \
|
||||
-classpath "${M2_HOME}"/core/boot/plexus-classworlds-*.jar \
|
||||
"-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
|
||||
"-Dmaven.home=${M2_HOME}" \
|
||||
${CLASSWORLDS_LAUNCHER} $QUOTED_ARGS
|
||||
|
|
|
@ -123,7 +123,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
|||
|
||||
@REM Start MAVEN2
|
||||
for %%i in ("%M2_HOME%"\core\boot\classworlds-*) do set CLASSWORLDS_JAR="%%i"
|
||||
%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" org.codehaus.classworlds.Launcher %MAVEN_CMD_LINE_ARGS%
|
||||
%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" org.codehaus.plexus.classworlds.launcher.Launcher %MAVEN_CMD_LINE_ARGS%
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
|||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.reactor.MavenExecutionException;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.codehaus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.maven.cli;
|
|||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
import org.codehaus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.util.StringOutputStream;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
|
|
@ -176,9 +176,9 @@
|
|||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>classworlds</groupId>
|
||||
<artifactId>classworlds</artifactId>
|
||||
<version>1.1</version>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-classworlds</artifactId>
|
||||
<version>1.2-alpha-4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -75,6 +75,7 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
|||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
|
@ -90,7 +91,9 @@ import java.util.Set;
|
|||
|
||||
public class DefaultPluginManager
|
||||
extends AbstractLogEnabled
|
||||
implements PluginManager, Initializable, Contextualizable
|
||||
implements PluginManager,
|
||||
Initializable,
|
||||
Contextualizable
|
||||
{
|
||||
protected PlexusContainer container;
|
||||
|
||||
|
@ -137,7 +140,9 @@ public class DefaultPluginManager
|
|||
return pluginCollector.getPluginDescriptorForPrefix( prefix );
|
||||
}
|
||||
|
||||
public Plugin getPluginDefinitionForPrefix( String prefix, MavenSession session, MavenProject project )
|
||||
public Plugin getPluginDefinitionForPrefix( String prefix,
|
||||
MavenSession session,
|
||||
MavenProject project )
|
||||
{
|
||||
// TODO: since this is only used in the lifecycle executor, maybe it should be moved there? There is no other
|
||||
// use for the mapping manager in here
|
||||
|
@ -146,7 +151,9 @@ public class DefaultPluginManager
|
|||
session.getLocalRepository() );
|
||||
}
|
||||
|
||||
public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
|
||||
public PluginDescriptor verifyPlugin( Plugin plugin,
|
||||
MavenProject project,
|
||||
Settings settings,
|
||||
ArtifactRepository localRepository )
|
||||
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
|
||||
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
|
||||
|
@ -164,7 +171,8 @@ public class DefaultPluginManager
|
|||
return verifyVersionedPlugin( plugin, project, localRepository );
|
||||
}
|
||||
|
||||
private PluginDescriptor verifyVersionedPlugin( Plugin plugin, MavenProject project,
|
||||
private PluginDescriptor verifyVersionedPlugin( Plugin plugin,
|
||||
MavenProject project,
|
||||
ArtifactRepository localRepository )
|
||||
throws PluginVersionResolutionException, ArtifactNotFoundException, ArtifactResolutionException,
|
||||
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException
|
||||
|
@ -240,7 +248,9 @@ 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
|
||||
|
@ -268,17 +278,18 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
protected void addPlugin( Plugin plugin, Artifact pluginArtifact, MavenProject project,
|
||||
protected void addPlugin( Plugin plugin,
|
||||
Artifact pluginArtifact,
|
||||
MavenProject project,
|
||||
ArtifactRepository localRepository )
|
||||
throws PluginManagerException, InvalidPluginException
|
||||
{
|
||||
PlexusContainer child;
|
||||
ClassRealm componentRealm;
|
||||
|
||||
try
|
||||
{
|
||||
child = container.createChildContainer( plugin.getKey(),
|
||||
Collections.singletonList( pluginArtifact.getFile() ),
|
||||
Collections.EMPTY_MAP,
|
||||
Collections.singletonList( pluginCollector ) );
|
||||
componentRealm = container.createComponentRealm( plugin.getKey(),
|
||||
Collections.singletonList( pluginArtifact.getFile() ) );
|
||||
}
|
||||
catch ( PlexusContainerException e )
|
||||
{
|
||||
|
@ -288,19 +299,21 @@ public class DefaultPluginManager
|
|||
|
||||
// this plugin's descriptor should have been discovered in the child creation, so we should be able to
|
||||
// circle around and set the artifacts and class realm
|
||||
PluginDescriptor addedPlugin = pluginCollector.getPluginDescriptor( plugin );
|
||||
PluginDescriptor pluginDescriptor = pluginCollector.getPluginDescriptor( plugin );
|
||||
|
||||
if ( addedPlugin == null )
|
||||
if ( pluginDescriptor == null )
|
||||
{
|
||||
throw new IllegalStateException( "The PluginDescriptor for the plugin " + plugin.getKey() + " was not found" );
|
||||
throw new IllegalStateException(
|
||||
"The PluginDescriptor for the plugin " + plugin.getKey() + " was not found" );
|
||||
}
|
||||
|
||||
addedPlugin.setClassRealm( child.getContainerRealm() );
|
||||
//pluginDescriptor.setClassRealm( child.getContainerRealm() );
|
||||
pluginDescriptor.setClassRealm( componentRealm );
|
||||
|
||||
// we're only setting the plugin's artifact itself as the artifact list, to allow it to be retrieved
|
||||
// later when the plugin is first invoked. Retrieving this artifact will in turn allow us to
|
||||
// transitively resolve its dependencies, and add them to the plugin container...
|
||||
addedPlugin.setArtifacts( Collections.singletonList( pluginArtifact ) );
|
||||
pluginDescriptor.setArtifacts( Collections.singletonList( pluginArtifact ) );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -317,10 +330,7 @@ public class DefaultPluginManager
|
|||
Set artifacts = MavenMetadataSource.createArtifacts( artifactFactory, projectPlugin.getDependencies(), null,
|
||||
null, project );
|
||||
|
||||
// Set artifacts =
|
||||
// MavenMetadataSource.createArtifacts( artifactFactory, plugin.getDependencies(), null, null, project );
|
||||
|
||||
addedPlugin.setIntroducedDependencyArtifacts( artifacts );
|
||||
pluginDescriptor.setIntroducedDependencyArtifacts( artifacts );
|
||||
}
|
||||
catch ( InvalidDependencyVersionException e )
|
||||
{
|
||||
|
@ -332,7 +342,9 @@ public class DefaultPluginManager
|
|||
// Mojo execution
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
public void executeMojo( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
||||
public void executeMojo( MavenProject project,
|
||||
MojoExecution mojoExecution,
|
||||
MavenSession session )
|
||||
throws ArtifactResolutionException, MojoExecutionException, MojoFailureException, ArtifactNotFoundException,
|
||||
InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException
|
||||
{
|
||||
|
@ -381,13 +393,21 @@ public class DefaultPluginManager
|
|||
Mojo plugin;
|
||||
|
||||
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
|
||||
|
||||
String goalId = mojoDescriptor.getGoal();
|
||||
|
||||
String groupId = pluginDescriptor.getGroupId();
|
||||
|
||||
String artifactId = pluginDescriptor.getArtifactId();
|
||||
|
||||
String executionId = mojoExecution.getExecutionId();
|
||||
|
||||
Xpp3Dom dom = project.getGoalConfiguration( groupId, artifactId, executionId, goalId );
|
||||
|
||||
Xpp3Dom reportDom = project.getReportConfiguration( groupId, artifactId, executionId );
|
||||
|
||||
dom = Xpp3Dom.mergeXpp3Dom( dom, reportDom );
|
||||
|
||||
if ( mojoExecution.getConfiguration() != null )
|
||||
{
|
||||
dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() );
|
||||
|
@ -397,6 +417,7 @@ public class DefaultPluginManager
|
|||
|
||||
// Event monitoring.
|
||||
String event = MavenEvents.MOJO_EXECUTION;
|
||||
|
||||
EventDispatcher dispatcher = session.getEventDispatcher();
|
||||
|
||||
String goalExecId = goalName;
|
||||
|
@ -412,8 +433,7 @@ public class DefaultPluginManager
|
|||
|
||||
try
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader(
|
||||
mojoDescriptor.getPluginDescriptor().getClassRealm().getClassLoader() );
|
||||
Thread.currentThread().setContextClassLoader( mojoDescriptor.getPluginDescriptor().getClassRealm() );
|
||||
|
||||
plugin.execute();
|
||||
|
||||
|
@ -436,6 +456,7 @@ public class DefaultPluginManager
|
|||
|
||||
Thread.currentThread().setContextClassLoader( oldClassLoader );
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
PlexusContainer pluginContainer = getPluginContainer( mojoDescriptor.getPluginDescriptor() );
|
||||
|
@ -449,10 +470,13 @@ public class DefaultPluginManager
|
|||
getLogger().error( "Error releasing plugin - ignoring.", e );
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
public MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
||||
public MavenReport getReport( MavenProject project,
|
||||
MojoExecution mojoExecution,
|
||||
MavenSession session )
|
||||
throws ArtifactNotFoundException, PluginConfigurationException, PluginManagerException,
|
||||
ArtifactResolutionException
|
||||
{
|
||||
|
@ -468,7 +492,9 @@ public class DefaultPluginManager
|
|||
return (MavenReport) getConfiguredMojo( session, dom, project, true, mojoExecution );
|
||||
}
|
||||
|
||||
public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
||||
public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin,
|
||||
MavenProject project,
|
||||
MavenSession session )
|
||||
throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException,
|
||||
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
|
||||
PluginVersionNotFoundException
|
||||
|
@ -496,6 +522,9 @@ public class DefaultPluginManager
|
|||
private PlexusContainer getPluginContainer( PluginDescriptor pluginDescriptor )
|
||||
throws PluginManagerException
|
||||
{
|
||||
return container;
|
||||
|
||||
/*
|
||||
String pluginKey = pluginDescriptor.getPluginLookupKey();
|
||||
|
||||
PlexusContainer pluginContainer = container.getChildContainer( pluginKey );
|
||||
|
@ -506,9 +535,13 @@ public class DefaultPluginManager
|
|||
}
|
||||
|
||||
return pluginContainer;
|
||||
*/
|
||||
}
|
||||
|
||||
private Mojo getConfiguredMojo( MavenSession session, Xpp3Dom dom, MavenProject project, boolean report,
|
||||
private Mojo getConfiguredMojo( MavenSession session,
|
||||
Xpp3Dom dom,
|
||||
MavenProject project,
|
||||
boolean report,
|
||||
MojoExecution mojoExecution )
|
||||
throws PluginConfigurationException, ArtifactNotFoundException, PluginManagerException,
|
||||
ArtifactResolutionException
|
||||
|
@ -588,8 +621,10 @@ public class DefaultPluginManager
|
|||
return plugin;
|
||||
}
|
||||
|
||||
private void ensurePluginContainerIsComplete( PluginDescriptor pluginDescriptor, PlexusContainer pluginContainer,
|
||||
MavenProject project, MavenSession session )
|
||||
private void ensurePluginContainerIsComplete( PluginDescriptor pluginDescriptor,
|
||||
PlexusContainer pluginContainer,
|
||||
MavenProject project,
|
||||
MavenSession session )
|
||||
throws ArtifactNotFoundException, PluginManagerException, ArtifactResolutionException
|
||||
{
|
||||
// if the plugin's already been used once, don't re-do this step...
|
||||
|
@ -621,9 +656,12 @@ public class DefaultPluginManager
|
|||
repositories.addAll( resolutionGroup.getResolutionRepositories() );
|
||||
repositories.addAll( project.getRemoteArtifactRepositories() );
|
||||
|
||||
List repositories = new ArrayList();
|
||||
repositories.addAll( resolutionGroup.getResolutionRepositories() );
|
||||
repositories.addAll( project.getRemoteArtifactRepositories() );
|
||||
|
||||
ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, pluginArtifact,
|
||||
localRepository,
|
||||
repositories,
|
||||
localRepository, repositories,
|
||||
artifactMetadataSource,
|
||||
artifactFilter );
|
||||
|
||||
|
@ -666,7 +704,8 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
private void resolveCoreArtifacts( List unresolved, ArtifactRepository localRepository,
|
||||
private void resolveCoreArtifacts( List unresolved,
|
||||
ArtifactRepository localRepository,
|
||||
List resolutionRepositories )
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||
{
|
||||
|
@ -751,7 +790,8 @@ public class DefaultPluginManager
|
|||
return extractedConfiguration;
|
||||
}
|
||||
|
||||
private void checkRequiredParameters( MojoDescriptor goal, PlexusConfiguration configuration,
|
||||
private void checkRequiredParameters( MojoDescriptor goal,
|
||||
PlexusConfiguration configuration,
|
||||
ExpressionEvaluator expressionEvaluator )
|
||||
throws PluginConfigurationException
|
||||
{
|
||||
|
@ -826,7 +866,8 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
private void validatePomConfiguration( MojoDescriptor goal, PlexusConfiguration pomConfiguration )
|
||||
private void validatePomConfiguration( MojoDescriptor goal,
|
||||
PlexusConfiguration pomConfiguration )
|
||||
throws PluginConfigurationException
|
||||
{
|
||||
List parameters = goal.getParameters();
|
||||
|
@ -873,7 +914,8 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
private PlexusConfiguration mergeMojoConfiguration( XmlPlexusConfiguration fromPom, MojoDescriptor mojoDescriptor )
|
||||
private PlexusConfiguration mergeMojoConfiguration( XmlPlexusConfiguration fromPom,
|
||||
MojoDescriptor mojoDescriptor )
|
||||
{
|
||||
XmlPlexusConfiguration result = new XmlPlexusConfiguration( fromPom.getName() );
|
||||
result.setValue( fromPom.getValue( null ) );
|
||||
|
@ -931,15 +973,14 @@ public class DefaultPluginManager
|
|||
|
||||
if ( toAdd != null )
|
||||
{
|
||||
if ( implementation != null
|
||||
&& toAdd.getAttribute( "implementation", null ) == null )
|
||||
if ( implementation != null && toAdd.getAttribute( "implementation", null ) == null )
|
||||
{
|
||||
|
||||
XmlPlexusConfiguration implementationConf = new XmlPlexusConfiguration( paramName );
|
||||
|
||||
implementationConf.setAttribute( "implementation", parameter.getImplementation() );
|
||||
|
||||
toAdd = buildTopDownMergedConfiguration( toAdd, implementationConf );
|
||||
toAdd = buildTopDownMergedConfiguration( toAdd, implementationConf );
|
||||
}
|
||||
|
||||
result.addChild( toAdd );
|
||||
|
@ -1033,8 +1074,11 @@ public class DefaultPluginManager
|
|||
// Mojo Parameter Handling
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
private void populatePluginFields( Mojo plugin, MojoDescriptor mojoDescriptor, PlexusConfiguration configuration,
|
||||
PlexusContainer pluginContainer, ExpressionEvaluator expressionEvaluator )
|
||||
private void populatePluginFields( Mojo plugin,
|
||||
MojoDescriptor mojoDescriptor,
|
||||
PlexusConfiguration configuration,
|
||||
PlexusContainer pluginContainer,
|
||||
ExpressionEvaluator expressionEvaluator )
|
||||
throws PluginConfigurationException
|
||||
{
|
||||
ComponentConfigurator configurator = null;
|
||||
|
@ -1089,7 +1133,8 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
public static String createPluginParameterRequiredMessage( MojoDescriptor mojo, Parameter parameter,
|
||||
public static String createPluginParameterRequiredMessage( MojoDescriptor mojo,
|
||||
Parameter parameter,
|
||||
String expression )
|
||||
{
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
@ -1128,8 +1173,11 @@ public class DefaultPluginManager
|
|||
// Artifact resolution
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
private void resolveTransitiveDependencies( MavenSession context, ArtifactResolver artifactResolver, String scope,
|
||||
ArtifactFactory artifactFactory, MavenProject project )
|
||||
private void resolveTransitiveDependencies( MavenSession context,
|
||||
ArtifactResolver artifactResolver,
|
||||
String scope,
|
||||
ArtifactFactory artifactFactory,
|
||||
MavenProject project )
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException, InvalidDependencyVersionException
|
||||
{
|
||||
ArtifactFilter filter = new ScopeArtifactFilter( scope );
|
||||
|
@ -1157,7 +1205,9 @@ public class DefaultPluginManager
|
|||
// Artifact downloading
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
private void downloadDependencies( MavenProject project, MavenSession context, ArtifactResolver artifactResolver )
|
||||
private void downloadDependencies( MavenProject project,
|
||||
MavenSession context,
|
||||
ArtifactResolver artifactResolver )
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||
{
|
||||
ArtifactRepository localRepository = context.getLocalRepository();
|
||||
|
@ -1171,7 +1221,9 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
public Object getPluginComponent( Plugin plugin, String role, String roleHint )
|
||||
public Object getPluginComponent( Plugin plugin,
|
||||
String role,
|
||||
String roleHint )
|
||||
throws PluginManagerException, ComponentLookupException
|
||||
{
|
||||
PluginDescriptor pluginDescriptor = pluginCollector.getPluginDescriptor( plugin );
|
||||
|
@ -1181,7 +1233,8 @@ public class DefaultPluginManager
|
|||
return pluginContainer.lookup( role, roleHint );
|
||||
}
|
||||
|
||||
public Map getPluginComponents( Plugin plugin, String role )
|
||||
public Map getPluginComponents( Plugin plugin,
|
||||
String role )
|
||||
throws ComponentLookupException, PluginManagerException
|
||||
{
|
||||
PluginDescriptor pluginDescriptor = pluginCollector.getPluginDescriptor( plugin );
|
||||
|
|
|
@ -50,7 +50,7 @@ public class MavenPluginCollector
|
|||
if ( componentSetDescriptor instanceof PluginDescriptor )
|
||||
{
|
||||
PluginDescriptor pluginDescriptor = (PluginDescriptor) componentSetDescriptor;
|
||||
|
||||
|
||||
// TODO: see comment in getPluginDescriptor
|
||||
String key = Plugin.constructKey( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId() );
|
||||
|
||||
|
@ -70,6 +70,11 @@ public class MavenPluginCollector
|
|||
}
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return "maven-plugin-collector";
|
||||
}
|
||||
|
||||
public PluginDescriptor getPluginDescriptor( Plugin plugin )
|
||||
{
|
||||
// TODO: include version, but can't do this in the plugin manager as it is not resolved to the right version
|
||||
|
|
|
@ -16,10 +16,11 @@ package org.apache.maven;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.codehaus.classworlds.ClassRealm;
|
||||
import org.codehaus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.DefaultPlexusContainer;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.PlexusContainerException;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -36,6 +37,7 @@ public class MavenTestUtils
|
|||
}
|
||||
|
||||
public static PlexusContainer getContainerInstance()
|
||||
throws PlexusContainerException
|
||||
{
|
||||
return new DefaultPlexusContainer();
|
||||
}
|
||||
|
|
|
@ -61,6 +61,15 @@
|
|||
-->
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -76,16 +85,22 @@
|
|||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>apache.releases</id>
|
||||
<name>Apache Release Distribution Repository</name>
|
||||
<url>scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>apache.snapshots</id>
|
||||
<name>Apache Development Snapshot Repository</name>
|
||||
<url>file:///tmp/embedder</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<!--
|
||||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-clover-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<outputFileNameMapping></outputFileNameMapping>
|
||||
<unpack>true</unpack>
|
||||
<scope>runtime</scope>
|
||||
<excludes>
|
||||
|
|
|
@ -48,15 +48,16 @@ import org.apache.maven.settings.Proxy;
|
|||
import org.apache.maven.settings.Server;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.apache.maven.wagon.events.TransferListener;
|
||||
import org.codehaus.classworlds.ClassWorld;
|
||||
import org.codehaus.classworlds.DuplicateRealmException;
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
|
||||
import org.codehaus.plexus.PlexusContainerException;
|
||||
import org.codehaus.plexus.component.repository.ComponentDescriptor;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||
import org.codehaus.plexus.configuration.PlexusConfigurationException;
|
||||
import org.codehaus.plexus.embed.Embedder;
|
||||
import org.codehaus.plexus.DefaultPlexusContainer;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.util.DirectoryScanner;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
@ -85,7 +86,7 @@ public class MavenEmbedder
|
|||
// Embedder
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
private Embedder embedder;
|
||||
private PlexusContainer container;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Components
|
||||
|
@ -444,7 +445,7 @@ public class MavenEmbedder
|
|||
checkStarted();
|
||||
List phases = new ArrayList();
|
||||
|
||||
ComponentDescriptor descriptor = embedder.getContainer().getComponentDescriptor( LifecycleExecutor.ROLE );
|
||||
ComponentDescriptor descriptor = container.getComponentDescriptor( LifecycleExecutor.ROLE );
|
||||
|
||||
PlexusConfiguration configuration = descriptor.getConfiguration();
|
||||
|
||||
|
@ -568,11 +569,19 @@ public class MavenEmbedder
|
|||
throw new IllegalStateException( "A classWorld or classloader must be specified using setClassLoader|World(ClassLoader)." );
|
||||
}
|
||||
|
||||
embedder = new Embedder();
|
||||
try
|
||||
{
|
||||
container = new DefaultPlexusContainer( null, null, null, classWorld );
|
||||
}
|
||||
catch ( PlexusContainerException e )
|
||||
{
|
||||
throw new MavenEmbedderException( "Error starting Maven embedder.", e );
|
||||
}
|
||||
|
||||
|
||||
if ( logger != null )
|
||||
{
|
||||
embedder.setLoggerManager( new MavenEmbedderLoggerManager( new PlexusLoggerAdapter( logger ) ) );
|
||||
container.setLoggerManager( new MavenEmbedderLoggerManager( new PlexusLoggerAdapter( logger ) ) );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -584,11 +593,12 @@ public class MavenEmbedder
|
|||
classWorld.newRealm( "plexus.core", classLoader );
|
||||
}
|
||||
|
||||
embedder.start( classWorld );
|
||||
// TODO verify that this is not needed...
|
||||
// embedder.start( classWorld );
|
||||
|
||||
if (req.getContainerCustomizer() != null)
|
||||
{
|
||||
req.getContainerCustomizer().customize(embedder.getContainer());
|
||||
req.getContainerCustomizer().customize(container);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -600,35 +610,35 @@ public class MavenEmbedder
|
|||
|
||||
modelWriter = new MavenXpp3Writer();
|
||||
|
||||
maven = (Maven) embedder.lookup( Maven.ROLE );
|
||||
maven = (Maven) container.lookup( Maven.ROLE );
|
||||
|
||||
mavenTools = (MavenTools) embedder.lookup( MavenTools.ROLE );
|
||||
mavenTools = (MavenTools) container.lookup( MavenTools.ROLE );
|
||||
|
||||
pluginDescriptorBuilder = new PluginDescriptorBuilder();
|
||||
|
||||
profileManager = new DefaultProfileManager( embedder.getContainer(), req.getSystemProperties() );
|
||||
profileManager = new DefaultProfileManager( container, req.getSystemProperties() );
|
||||
|
||||
profileManager.explicitlyActivate(req.getActiveProfiles());
|
||||
|
||||
profileManager.explicitlyDeactivate(req.getInactiveProfiles());
|
||||
|
||||
mavenProjectBuilder = (MavenProjectBuilder) embedder.lookup( MavenProjectBuilder.ROLE );
|
||||
mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Artifact related components
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
artifactRepositoryFactory = (ArtifactRepositoryFactory) embedder.lookup( ArtifactRepositoryFactory.ROLE );
|
||||
artifactRepositoryFactory = (ArtifactRepositoryFactory) container.lookup( ArtifactRepositoryFactory.ROLE );
|
||||
|
||||
artifactFactory = (ArtifactFactory) embedder.lookup( ArtifactFactory.ROLE );
|
||||
artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE );
|
||||
|
||||
artifactResolver = (ArtifactResolver) embedder.lookup( ArtifactResolver.ROLE );
|
||||
artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
|
||||
|
||||
defaultArtifactRepositoryLayout = (ArtifactRepositoryLayout) embedder.lookup( ArtifactRepositoryLayout.ROLE, DEFAULT_LAYOUT_ID );
|
||||
defaultArtifactRepositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, DEFAULT_LAYOUT_ID );
|
||||
|
||||
lifecycleExecutor = (LifecycleExecutor) embedder.lookup( LifecycleExecutor.ROLE );
|
||||
lifecycleExecutor = (LifecycleExecutor) container.lookup( LifecycleExecutor.ROLE );
|
||||
|
||||
wagonManager = (WagonManager) embedder.lookup( WagonManager.ROLE );
|
||||
wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
|
||||
|
||||
settings = mavenTools.buildSettings( req.getUserSettingsFile(),
|
||||
req.getGlobalSettingsFile(),
|
||||
|
@ -643,10 +653,6 @@ public class MavenEmbedder
|
|||
localRepository = createLocalRepository( settings );
|
||||
|
||||
}
|
||||
catch ( PlexusContainerException e )
|
||||
{
|
||||
throw new MavenEmbedderException( "Cannot start Plexus embedder.", e );
|
||||
}
|
||||
catch ( DuplicateRealmException e )
|
||||
{
|
||||
throw new MavenEmbedderException( "Cannot create Classworld realm for the embedder.", e );
|
||||
|
@ -723,11 +729,11 @@ public class MavenEmbedder
|
|||
started = false;
|
||||
try
|
||||
{
|
||||
embedder.release( mavenProjectBuilder );
|
||||
container.release( mavenProjectBuilder );
|
||||
|
||||
embedder.release( artifactRepositoryFactory );
|
||||
container.release( artifactRepositoryFactory );
|
||||
|
||||
embedder.release( lifecycleExecutor );
|
||||
container.release( lifecycleExecutor );
|
||||
}
|
||||
catch ( ComponentLifecycleException e )
|
||||
{
|
||||
|
|
|
@ -78,6 +78,13 @@ public class MavenEmbedderLoggerManager
|
|||
this.currentThreshold = currentThreshold;
|
||||
}
|
||||
|
||||
public void setThresholds( int currentThreshold )
|
||||
{
|
||||
this.currentThreshold = currentThreshold;
|
||||
|
||||
logger.setThreshold( currentThreshold );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the threshold.
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.plugin.lifecycle.Lifecycle;
|
||||
import org.apache.maven.plugin.lifecycle.LifecycleConfiguration;
|
||||
import org.apache.maven.plugin.lifecycle.io.xpp3.LifecycleMappingsXpp3Reader;
|
||||
import org.codehaus.classworlds.ClassRealm;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-ant-factory</artifactId>
|
||||
<version>1.0-alpha-2-SNAPSHOT</version>
|
||||
<version>1.0-alpha-4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.apache.maven.script.ant;
|
||||
|
||||
import org.codehaus.classworlds.ClassRealm;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.component.factory.ComponentInstantiationException;
|
||||
import org.codehaus.plexus.component.factory.ant.AntComponentFactory;
|
||||
import org.codehaus.plexus.component.factory.ant.AntScriptInvoker;
|
||||
|
@ -10,7 +10,6 @@ import org.codehaus.plexus.component.repository.ComponentDescriptor;
|
|||
public class AntMojoComponentFactory
|
||||
extends AntComponentFactory
|
||||
{
|
||||
|
||||
public Object newInstance( ComponentDescriptor descriptor, ClassRealm realm, PlexusContainer container )
|
||||
throws ComponentInstantiationException
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-bsh-factory</artifactId>
|
||||
<version>1.0-alpha-7</version>
|
||||
<version>1.0-alpha-9-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
13
pom.xml
13
pom.xml
|
@ -158,9 +158,18 @@
|
|||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<!-- We need to upgrade this to 1.0-alpha-10-SNAPSHOT for >= 2.0.5, to correct MNG-2201 -->
|
||||
<version>1.0-alpha-9</version>
|
||||
<version>1.0-alpha-12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-api</artifactId>
|
||||
<version>1.0-alpha-12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-classworlds</artifactId>
|
||||
<version>1.2-alpha-5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
|
|
Loading…
Reference in New Issue