mirror of https://github.com/apache/maven.git
o Changed to depend on plexus-0.17 instead of -0.16
o Changed the embedder/container used to be the new artifact-aware container (plexus-artifact-container-1.0-alpha-1) o Added new dependency to maven-core for artifact-container. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b93016e064
commit
24ce8263d9
|
@ -4,3 +4,4 @@ target
|
||||||
.project
|
.project
|
||||||
bootstrap.repo
|
bootstrap.repo
|
||||||
maven-component.i*
|
maven-component.i*
|
||||||
|
.settings
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus</artifactId>
|
<artifactId>plexus</artifactId>
|
||||||
<version>0.16</version>
|
<version>0.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xstream</groupId>
|
<groupId>xstream</groupId>
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
<package>org.apache.maven</package>
|
<package>org.apache.maven</package>
|
||||||
<logo>/images/maven.gif</logo>
|
<logo>/images/maven.gif</logo>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>plexus</groupId>
|
||||||
|
<artifactId>plexus-artifact-container</artifactId>
|
||||||
|
<version>1.0-alpha-1</version>
|
||||||
|
</dependency>
|
||||||
<!-- maven component -->
|
<!-- maven component -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.project.MavenProjectBuilder;
|
import org.apache.maven.project.MavenProjectBuilder;
|
||||||
import org.apache.maven.project.ProjectBuildingException;
|
import org.apache.maven.project.ProjectBuildingException;
|
||||||
|
import org.codehaus.plexus.ArtifactEnabledContainer;
|
||||||
import org.codehaus.plexus.PlexusConstants;
|
import org.codehaus.plexus.PlexusConstants;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.context.Context;
|
import org.codehaus.plexus.context.Context;
|
||||||
|
@ -50,7 +51,7 @@ public class DefaultMaven
|
||||||
extends AbstractLogEnabled
|
extends AbstractLogEnabled
|
||||||
implements Maven, Contextualizable
|
implements Maven, Contextualizable
|
||||||
{
|
{
|
||||||
private PlexusContainer container;
|
private ArtifactEnabledContainer container;
|
||||||
|
|
||||||
private String mavenHome;
|
private String mavenHome;
|
||||||
|
|
||||||
|
@ -363,7 +364,7 @@ public class DefaultMaven
|
||||||
public void contextualize( Context context )
|
public void contextualize( Context context )
|
||||||
throws ContextException
|
throws ContextException
|
||||||
{
|
{
|
||||||
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
container = (ArtifactEnabledContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.commons.cli.ParseException;
|
||||||
import org.apache.commons.cli.PosixParser;
|
import org.apache.commons.cli.PosixParser;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.codehaus.classworlds.ClassWorld;
|
import org.codehaus.classworlds.ClassWorld;
|
||||||
|
import org.codehaus.plexus.embed.ArtifactEnabledEmbedder;
|
||||||
import org.codehaus.plexus.embed.Embedder;
|
import org.codehaus.plexus.embed.Embedder;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public class MavenCli
|
||||||
|
|
||||||
//---
|
//---
|
||||||
|
|
||||||
Embedder embedder = new Embedder();
|
ArtifactEnabledEmbedder embedder = new ArtifactEnabledEmbedder();
|
||||||
|
|
||||||
embedder.start( classWorld );
|
embedder.start( classWorld );
|
||||||
|
|
||||||
|
|
|
@ -37,73 +37,10 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public class GoalDecorationPhase extends AbstractMavenGoalPhase
|
public class GoalDecorationPhase extends AbstractMavenGoalPhase
|
||||||
{
|
{
|
||||||
public static final String MAVEN_XML_DEFAULT_NAMESPACE = "mavenxml";
|
|
||||||
public static final String MAVEN_SCRIPT = "decorators.xml";
|
|
||||||
private GoalDecoratorBindings decorators;
|
|
||||||
private boolean decoratorsInitialized = false;
|
|
||||||
|
|
||||||
public void execute( MavenGoalExecutionContext context )
|
public void execute( MavenGoalExecutionContext context )
|
||||||
throws GoalExecutionException
|
throws GoalExecutionException
|
||||||
{
|
{
|
||||||
synchronized ( this )
|
|
||||||
{
|
|
||||||
if ( !decoratorsInitialized )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
initializeDecorators( context );
|
|
||||||
}
|
|
||||||
catch ( XmlPullParserException e )
|
|
||||||
{
|
|
||||||
throw new GoalExecutionException( "Error parsing decorators.xml: ", e );
|
|
||||||
}
|
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
throw new GoalExecutionException( "Error reading decorators.xml file: ", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.setGoalDecoratorBindings( decorators );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeDecorators( MavenGoalExecutionContext context )
|
|
||||||
throws XmlPullParserException, IOException
|
|
||||||
{
|
|
||||||
MavenProject project = context.getProject();
|
|
||||||
|
|
||||||
File pom = project.getFile();
|
|
||||||
|
|
||||||
File dir = pom.getParentFile();
|
|
||||||
|
|
||||||
File scriptFile = new File( dir, MAVEN_SCRIPT );
|
|
||||||
|
|
||||||
if ( scriptFile.exists() )
|
|
||||||
{
|
|
||||||
BufferedReader reader = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
reader = new BufferedReader( new FileReader( scriptFile ) );
|
|
||||||
|
|
||||||
GoalDecorationParser parser = new GoalDecorationParser();
|
|
||||||
this.decorators = parser.parse( reader );
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if ( reader != null )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
reader.close();
|
|
||||||
}
|
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
decoratorsInitialized = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
|
import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
|
||||||
|
import org.codehaus.plexus.ArtifactEnabledContainer;
|
||||||
import org.codehaus.plexus.PlexusConstants;
|
import org.codehaus.plexus.PlexusConstants;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
|
import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
|
||||||
|
@ -62,7 +63,7 @@ public class DefaultPluginManager
|
||||||
|
|
||||||
protected ArtifactHandlerManager artifactHandlerManager;
|
protected ArtifactHandlerManager artifactHandlerManager;
|
||||||
|
|
||||||
protected PlexusContainer container;
|
protected ArtifactEnabledContainer container;
|
||||||
|
|
||||||
protected PluginDescriptorBuilder pluginDescriptorBuilder;
|
protected PluginDescriptorBuilder pluginDescriptorBuilder;
|
||||||
|
|
||||||
|
@ -279,7 +280,7 @@ public class DefaultPluginManager
|
||||||
public void contextualize( Context context )
|
public void contextualize( Context context )
|
||||||
throws ContextException
|
throws ContextException
|
||||||
{
|
{
|
||||||
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
container = (ArtifactEnabledContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize()
|
public void initialize()
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.project.MavenProjectBuilder;
|
import org.apache.maven.project.MavenProjectBuilder;
|
||||||
import org.codehaus.classworlds.ClassRealm;
|
import org.codehaus.classworlds.ClassRealm;
|
||||||
import org.codehaus.classworlds.ClassWorld;
|
import org.codehaus.classworlds.ClassWorld;
|
||||||
|
import org.codehaus.plexus.ArtifactEnabledPlexusTestCase;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -36,7 +37,7 @@ import java.util.List;
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class MavenTestCase
|
public class MavenTestCase
|
||||||
extends PlexusTestCase
|
extends ArtifactEnabledPlexusTestCase
|
||||||
{
|
{
|
||||||
protected PluginManager pluginManager;
|
protected PluginManager pluginManager;
|
||||||
|
|
||||||
|
|
|
@ -324,6 +324,20 @@
|
||||||
<description>Distribution information for a project.</description>
|
<description>Distribution information for a project.</description>
|
||||||
<type>DistributionManagement</type>
|
<type>DistributionManagement</type>
|
||||||
</field>
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>preGoals</name>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
<description>Set of decorator(s) injected before the target goal(s).</description>
|
||||||
|
<type>java.util.List</type>
|
||||||
|
<defaultValue>new java.util.ArrayList()</defaultValue>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>postGoals</name>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
<description>Set of decorator(s) injected after the target goal(s).</description>
|
||||||
|
<type>java.util.List</type>
|
||||||
|
<defaultValue>new java.util.ArrayList()</defaultValue>
|
||||||
|
</field>
|
||||||
</fields>
|
</fields>
|
||||||
<!-- We need this because we can't use package as a field name. -->
|
<!-- We need this because we can't use package as a field name. -->
|
||||||
<codeSegments>
|
<codeSegments>
|
||||||
|
@ -1264,6 +1278,38 @@
|
||||||
</field>
|
</field>
|
||||||
</fields>
|
</fields>
|
||||||
</class>
|
</class>
|
||||||
|
<class>
|
||||||
|
<name>GoalDecorator</name>
|
||||||
|
<version>3.0.0+</version>
|
||||||
|
<fields>
|
||||||
|
<field>
|
||||||
|
<name>name</name>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
<description>The target goal which should be decorated.</description>
|
||||||
|
<type>String</type>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>attain</name>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
<description>
|
||||||
|
The goal which should be injected into the execution chain.
|
||||||
|
</description>
|
||||||
|
<type>String</type>
|
||||||
|
</field>
|
||||||
|
</fields>
|
||||||
|
</class>
|
||||||
|
<class>
|
||||||
|
<superClass>GoalDecorator</superClass>
|
||||||
|
<name>PreGoal</name>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
<fields></fields>
|
||||||
|
</class>
|
||||||
|
<class>
|
||||||
|
<superClass>GoalDecorator</superClass>
|
||||||
|
<name>PostGoal</name>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
<fields></fields>
|
||||||
|
</class>
|
||||||
|
|
||||||
</classes>
|
</classes>
|
||||||
</model>
|
</model>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus</artifactId>
|
<artifactId>plexus</artifactId>
|
||||||
<version>0.16</version>
|
<version>0.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus</artifactId>
|
<artifactId>plexus</artifactId>
|
||||||
<version>0.16</version>
|
<version>0.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus</artifactId>
|
<artifactId>plexus</artifactId>
|
||||||
<version>0.16</version>
|
<version>0.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -78,7 +78,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus</artifactId>
|
<artifactId>plexus</artifactId>
|
||||||
<version>0.16</version>
|
<version>0.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xstream</groupId>
|
<groupId>xstream</groupId>
|
||||||
|
|
Loading…
Reference in New Issue