Working on MNG-607

o Changed MavenMetadataSource to a component, to avoid having to lookup artifactFactory and projectBuilder in order to 
  construct it.

o Added add(..) method to ScmBean in the release plugin to allow addition of release-pom.xml

o Changed the PrepareReleaseMojo to resolve ONLY version and parent-version for the normal pom.xml, and fully resolve all
  artifacts used in the release-pom.xml, including version, parent-version, dependency closure (given by project.getArtifacts()), plugins, and reports. It will then add the release-pom.xml, and (attempt to) delete it before performing the final commit for next development version.

o Added some mapping methods to ArtifactUtils, to key by artifact.getId, and to create an Artifact.getId()-compatible string from parameters.

o Added TestProjectBuilder to remove the requirement in ProjectClasspathTest to modify the fields of the project builder directly.

o Cleaned up the AbstractReleaseMojo and PrepareReleaseMojo to avoid container lookups...they're now mojo parameters with the 'component.' prefix.

NOTE: Next step is to figure out how to use maven-scm to remove an SCM resource, to enable the prepare mojo to take the release-pom.xml back out of HEAD after the tag is complete.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@224413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-07-22 22:07:28 +00:00
parent 22282d4f24
commit 701ef520a3
24 changed files with 647 additions and 280 deletions

View File

@ -3,7 +3,6 @@ package org.apache.maven.artifact;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public final class ArtifactUtils
@ -23,7 +22,17 @@ public final class ArtifactUtils
return groupId + ":" + artifactId;
}
public static Map artifactMap( Collection artifacts )
public static String artifactId( String groupId, String artifactId, String type, String version )
{
return artifactId( groupId, artifactId, type, version, null, version );
}
public static String artifactId( String groupId, String artifactId, String type, String version, String classifier, String baseVersion )
{
return groupId + ":" + artifactId + ":" + type + ( ( classifier != null ) ? ( ":" + classifier ) : ( "" ) ) + ":" + baseVersion;
}
public static Map artifactMapByVersionlessId( Collection artifacts )
{
Map artifactMap = new HashMap();
@ -37,4 +46,18 @@ public final class ArtifactUtils
return artifactMap;
}
public static Map artifactMapByArtifactId( Collection artifacts )
{
Map artifactMap = new HashMap();
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
{
Artifact artifact = (Artifact) it.next();
artifactMap.put( artifact.getId(), artifact );
}
return artifactMap;
}
}

View File

@ -177,6 +177,10 @@ public class DefaultMaven
try
{
MavenSession session = createSession( request, projects );
List goals = request.getGoals();
for ( Iterator iterator = projects.iterator(); iterator.hasNext(); )
{
MavenProject project = (MavenProject) iterator.next();
@ -189,7 +193,7 @@ public class DefaultMaven
try
{
MavenExecutionResponse response = processProject( request, project, dispatcher );
MavenExecutionResponse response = processProject( session, goals, project, dispatcher );
if ( response.isExecutionFailure() )
{
dispatcher.dispatchError( event, request.getBaseDirectory(), response.getException() );
@ -262,14 +266,10 @@ public class DefaultMaven
return projects;
}
private MavenExecutionResponse processProject( MavenExecutionRequest request, MavenProject project,
private MavenExecutionResponse processProject( MavenSession session, List goals, MavenProject project,
EventDispatcher dispatcher )
throws LifecycleExecutionException
{
List goals = request.getGoals();
MavenSession session = createSession( request, project );
// !! This is ripe for refactoring to an aspect.
// Event monitoring.
String event = MavenEvents.PROJECT_EXECUTION;
@ -412,10 +412,10 @@ public class DefaultMaven
// the session type would be specific to the request i.e. having a project
// or not.
protected MavenSession createSession( MavenExecutionRequest request, MavenProject project )
protected MavenSession createSession( MavenExecutionRequest request, List projects )
{
return new MavenSession( project, container, request.getSettings(), request.getLocalRepository(),
request.getEventDispatcher(), request.getGoals() );
return new MavenSession( container, request.getSettings(), request.getLocalRepository(),
request.getEventDispatcher(), projects, request.getGoals(), request.getBaseDirectory() );
}
/**

View File

@ -19,11 +19,9 @@ package org.apache.maven.execution;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.plugin.mapping.PluginMappingManager;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.context.Context;
import java.util.List;
import java.util.Map;
@ -36,8 +34,6 @@ public class MavenSession
{
private PlexusContainer container;
private MavenProject project;
private ArtifactRepository localRepository;
private List goals;
@ -49,11 +45,14 @@ public class MavenSession
// TODO: make this the central one, get rid of build settings...
private final Settings settings;
public MavenSession( MavenProject project, PlexusContainer container, Settings settings,
ArtifactRepository localRepository, EventDispatcher eventDispatcher, List goals )
{
this.project = project;
private List sortedProjects;
private final String executionRootDir;
public MavenSession( PlexusContainer container, Settings settings,
ArtifactRepository localRepository, EventDispatcher eventDispatcher, List sortedProjects,
List goals, String executionRootDir )
{
this.container = container;
this.settings = settings;
@ -61,26 +60,12 @@ public class MavenSession
this.localRepository = localRepository;
this.eventDispatcher = eventDispatcher;
this.sortedProjects = sortedProjects;
this.goals = goals;
// TODO: Go back to this when we get the container ready to configure mojos...
// NOTE: [jc] This is a possible way to add project, etc. to the container context to allow container-injected
// mojo configuration.
// initializeContainerContext();
}
private void initializeContainerContext()
{
Context context = container.getContext();
context.put( "project", project );
context.put( "settings", settings );
context.put( "basedir", project.getBasedir().getAbsolutePath() );
context.put( "localRepository", localRepository );
// TODO: remove this alias...change to ${project.build.finalName}
context.put( "maven.final.name", project.getBuild().getFinalName() );
this.executionRootDir = executionRootDir;
}
public PlexusContainer getContainer()
@ -145,4 +130,14 @@ public class MavenSession
{
return pluginMappingManager;
}
public List getSortedProjects()
{
return sortedProjects;
}
public String getExecutionRootDirectory()
{
return executionRootDir;
}
}

View File

@ -17,6 +17,7 @@ package org.apache.maven.plugin;
*/
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
@ -112,7 +113,7 @@ public class DefaultPluginManager
protected ArtifactResolver artifactResolver;
protected ArtifactMetadataSource metadataSource;
protected ArtifactMetadataSource artifactMetadataSource;
protected MavenPluginMappingBuilder pluginMappingBuilder;
@ -172,6 +173,15 @@ public class DefaultPluginManager
public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
ArtifactRepository localRepository )
throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException
{
Artifact existingPluginArtifact = (Artifact) project.getPluginArtifactMap().get( plugin.getKey() );
return verifyPlugin( plugin, existingPluginArtifact, project, settings, localRepository );
}
private PluginDescriptor verifyPlugin( Plugin plugin, Artifact existingArtifact, MavenProject project, Settings settings,
ArtifactRepository localRepository )
throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException
{
// TODO: this should be possibly outside
// All version-resolution logic has been moved to DefaultPluginVersionManager.
@ -189,6 +199,7 @@ public class DefaultPluginManager
{
VersionRange versionRange = VersionRange.createFromVersionSpec( plugin.getVersion() );
checkRequiredMavenVersion( plugin, localRepository, project.getPluginArtifactRepositories() );
Artifact pluginArtifact = artifactFactory.createPluginArtifact( plugin.getGroupId(),
@ -382,17 +393,33 @@ public class DefaultPluginManager
}
}
public List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session,
ArtifactRepository localRepository )
public List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session )
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException,
ArtifactResolutionException
{
Plugin forLookup = new Plugin();
forLookup.setGroupId( reportPlugin.getGroupId() );
forLookup.setArtifactId( reportPlugin.getArtifactId() );
forLookup.setVersion( reportPlugin.getVersion() );
String groupId = reportPlugin.getGroupId();
String artifactId = reportPlugin.getArtifactId();
forLookup.setGroupId( groupId );
forLookup.setArtifactId( artifactId );
PluginDescriptor pluginDescriptor = verifyPlugin( forLookup, project, session.getSettings(), localRepository );
String version = reportPlugin.getVersion();
Artifact existingPluginArtifact = (Artifact) project.getReportArtifactMap().get( reportPlugin.getKey() );
if ( existingPluginArtifact == null
|| !reportPlugin.getKey().equals( ArtifactUtils.versionlessKey( existingPluginArtifact ) )
|| version == null )
{
version = pluginVersionManager.resolvePluginVersion( groupId, artifactId, project, session.getSettings(), session.getLocalRepository(), true );
}
forLookup.setVersion( version );
PluginDescriptor pluginDescriptor = verifyPlugin( forLookup, existingPluginArtifact, project, session
.getSettings(), session.getLocalRepository() );
List reports = new ArrayList();
for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
@ -516,7 +543,7 @@ public class DefaultPluginManager
{
ArtifactRepository localRepository = session.getLocalRepository();
ResolutionGroup resolutionGroup = metadataSource.retrieve( pluginArtifact, localRepository,
ResolutionGroup resolutionGroup = artifactMetadataSource.retrieve( pluginArtifact, localRepository,
project.getPluginArtifactRepositories() );
Set dependencies = resolutionGroup.getArtifacts();
@ -524,7 +551,7 @@ public class DefaultPluginManager
ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, pluginArtifact,
localRepository,
resolutionGroup.getResolutionRepositories(),
metadataSource,
artifactMetadataSource,
artifactFilter );
Set resolved = result.getArtifacts();
@ -1015,7 +1042,7 @@ public class DefaultPluginManager
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getDependencyArtifacts(),
artifact, context.getLocalRepository(),
project.getRemoteArtifactRepositories(),
metadataSource, filter );
artifactMetadataSource, filter );
project.setArtifacts( result.getArtifacts() );
}

View File

@ -51,8 +51,7 @@ public interface PluginManager
ArtifactRepository localRepository )
throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException;
List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session,
ArtifactRepository localRepository )
List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session )
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException,
ArtifactResolutionException;

View File

@ -21,7 +21,6 @@ import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.transform.LatestArtifactTransformation;
import org.apache.maven.artifact.transform.ReleaseArtifactTransformation;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
@ -61,17 +60,15 @@ public class DefaultPluginVersionManager
{
private MavenPluginRegistryBuilder mavenPluginRegistryBuilder;
private ArtifactResolver artifactResolver;
private ArtifactFactory artifactFactory;
private InputHandler inputHandler;
private ArtifactMetadataSource artifactMetadataSource;
// calculated.
private PluginRegistry pluginRegistry;
private ArtifactMetadataSource metadataSource;
private MavenProjectBuilder mavenProjectBuilder;
private RuntimeInformation runtimeInformation;
@ -79,9 +76,16 @@ public class DefaultPluginVersionManager
public String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
ArtifactRepository localRepository )
throws PluginVersionResolutionException
{
return resolvePluginVersion( groupId, artifactId, project, settings, localRepository, false );
}
public String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
ArtifactRepository localRepository, boolean resolveAsReportPlugin )
throws PluginVersionResolutionException
{
// first pass...if the plugin is specified in the pom, try to retrieve the version from there.
String version = getVersionFromPluginConfig( groupId, artifactId, project );
String version = getVersionFromPluginConfig( groupId, artifactId, project, resolveAsReportPlugin );
// we're NEVER going to persist POM-derived plugin versions.
String updatedVersion = null;
@ -474,33 +478,33 @@ public class DefaultPluginVersionManager
return groupId + ":" + artifactId;
}
private String getVersionFromPluginConfig( String groupId, String artifactId, MavenProject project )
private String getVersionFromPluginConfig( String groupId, String artifactId, MavenProject project, boolean resolveAsReportPlugin )
{
String version = null;
for ( Iterator it = project.getBuildPlugins().iterator(); it.hasNext(); )
{
Plugin plugin = (Plugin) it.next();
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
{
version = plugin.getVersion();
break;
}
}
// won't this overwrite the above loop if it exists in both places (unlikely, I know)??
// maybe that's the idea...?
if ( project.getReportPlugins() != null )
if ( resolveAsReportPlugin )
{
for ( Iterator it = project.getReportPlugins().iterator(); it.hasNext(); )
{
ReportPlugin reportPlugin = (ReportPlugin) it.next();
ReportPlugin plugin = (ReportPlugin) it.next();
if ( groupId.equals( reportPlugin.getGroupId() ) && artifactId.equals( reportPlugin.getArtifactId() ) )
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
{
version = reportPlugin.getVersion();
version = plugin.getVersion();
break;
}
}
}
else
{
for ( Iterator it = project.getBuildPlugins().iterator(); it.hasNext(); )
{
Plugin plugin = (Plugin) it.next();
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
{
version = plugin.getVersion();
break;
}
@ -620,7 +624,7 @@ public class DefaultPluginVersionManager
String version = null;
try
{
metadataSource.retrieve( artifact, localRepository, remoteRepositories );
artifactMetadataSource.retrieve( artifact, localRepository, remoteRepositories );
MavenProject project = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories,
localRepository );

View File

@ -28,4 +28,7 @@ public interface PluginVersionManager
String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings, ArtifactRepository localRepository )
throws PluginVersionResolutionException;
String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings, ArtifactRepository localRepository, boolean resolveAsReportPlugin )
throws PluginVersionResolutionException;
}

View File

@ -229,9 +229,6 @@
<requirement>
<role>org.apache.maven.plugin.registry.MavenPluginRegistryBuilder</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>

View File

@ -66,11 +66,11 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( expected, actual );
}
private static MavenSession createSession( MavenProject project, PlexusContainer container,
private static MavenSession createSession( PlexusContainer container,
ArtifactRepository repo )
{
return new MavenSession( project, container, new Settings(), repo, new DefaultEventDispatcher(),
Collections.EMPTY_LIST );
return new MavenSession( container, new Settings(), repo, new DefaultEventDispatcher(),
Collections.EMPTY_LIST, Collections.EMPTY_LIST, "." );
}
public void testLocalRepositoryExtraction()
@ -137,7 +137,7 @@ public class PluginParameterExpressionEvaluatorTest
ArtifactRepository repo = new DefaultArtifactRepository( "local", "target/repo", repoLayout );
PlexusContainer container = getContainer();
MavenSession session = createSession( project, container, repo );
MavenSession session = createSession( container, repo );
return (ExpressionEvaluator) new PluginParameterExpressionEvaluator( session, pluginDescriptor, null,
container.getLogger(), project );

View File

@ -223,7 +223,7 @@ public class PluginDescriptor
{
if ( artifactMap == null )
{
artifactMap = ArtifactUtils.artifactMap( getArtifacts() );
artifactMap = ArtifactUtils.artifactMapByVersionlessId( getArtifacts() );
}
return artifactMap;

View File

@ -21,16 +21,11 @@ import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.scm.ScmBean;
import org.apache.maven.project.MavenProject;
import org.apache.maven.scm.manager.ScmManager;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import java.util.Properties;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.File;
import java.util.Properties;
/**
*
@ -39,7 +34,6 @@ import java.io.File;
*/
public abstract class AbstractReleaseMojo
extends AbstractMojo
implements Contextualizable
{
public static final String RELEASE_PROPS = "release.properties";
@ -88,8 +82,11 @@ public abstract class AbstractReleaseMojo
*/
protected MavenProject project;
private PlexusContainer container;
/**
* @parameter expression="${org.apache.maven.scm.manager.ScmManager}"
* @required
* @readonly
*/
protected ScmManager scmManager;
private Properties releaseProperties;
@ -130,18 +127,11 @@ public abstract class AbstractReleaseMojo
return scm;
}
public PlexusContainer getContainer()
{
return container;
}
public void execute()
throws MojoExecutionException
{
try
{
initScmManager();
if ( username == null )
{
username = System.getProperty( "user.name" );
@ -169,40 +159,10 @@ public abstract class AbstractReleaseMojo
throw new MojoExecutionException( "Can't initialize ReleaseMojo.", e );
}
try
{
executeTask();
}
finally
{
releaseScmManager();
}
executeTask();
}
protected abstract void executeTask()
throws MojoExecutionException;
private void initScmManager()
throws Exception
{
scmManager = (ScmManager) container.lookup( ScmManager.ROLE );
}
private void releaseScmManager()
{
try
{
container.release( scmManager );
}
catch ( Exception e )
{
getLog().warn( "Error releasing component - ignoring", e );
}
}
public void contextualize( Context context )
throws ContextException
{
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
}

View File

@ -17,9 +17,14 @@ package org.apache.maven.plugin.release;
*/
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.scm.ScmBean;
import org.apache.maven.plugin.transformer.PomTransformer;
@ -27,16 +32,21 @@ import org.apache.maven.plugin.transformer.VersionTransformer;
import org.apache.maven.project.MavenProject;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFile;
import org.apache.maven.scm.ScmFileStatus;
import org.codehaus.plexus.components.inputhandler.InputHandler;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
@ -64,9 +74,32 @@ public class PrepareReleaseMojo
* @readonly
*/
private boolean interactive = true;
/**
* @parameter expression="${component.org.apache.maven.artifact.metadata.ArtifactMetadataSource}"
* @required
* @readonly
*/
private ArtifactMetadataSource artifactMetadataSource;
/**
* @parameter expression="${component.org.codehaus.plexus.components.inputhandler.InputHandler}"
* @required
* @readonly
*/
private InputHandler inputHandler;
/**
* @parameter expression="${localRepository}"
* @required
* @readonly
*/
private ArtifactRepository localRepository;
private static final String SNAPSHOT = "-SNAPSHOT";
private static final String RELEASE_POM = "release-pom.xml";
private String projectVersion;
private Model model;
@ -89,16 +122,48 @@ public class PrepareReleaseMojo
checkForPresenceOfSnapshots();
transformPomToReleaseVersionPom();
generateReleasePropertiesFile();
generateReleasePom();
checkInReleaseVersionPom();
tagRelease();
transformPomToSnapshotVersionPom();
new File( basedir, RELEASE_POM ).delete();
checkInSnapshotVersionPom();
}
private void generateReleasePropertiesFile() throws MojoExecutionException
{
try
{
Properties releaseProperties = new Properties();
releaseProperties.setProperty( "version", projectVersion );
releaseProperties.setProperty( USERNAME, username );
releaseProperties.setProperty( TAG, getTagLabel() );
releaseProperties.setProperty( SCM_URL, urlScm );
FileOutputStream os = new FileOutputStream( new File( project.getFile().getParentFile(), RELEASE_PROPS ) );
releaseProperties.store( os, "maven release plugin info" );
os.close();
}
catch ( IOException e )
{
throw new MojoExecutionException( "Cannote write release-version file.", e );
}
}
private boolean isSnapshot( String version )
{
return version.endsWith( SNAPSHOT );
@ -250,9 +315,7 @@ public class PrepareReleaseMojo
{
getLog().info( "What is the new version? [" + projectVersion + "]" );
InputHandler handler = (InputHandler) getContainer().lookup( InputHandler.ROLE );
String inputVersion = handler.readLine();
String inputVersion = inputHandler.readLine();
if ( !StringUtils.isEmpty( inputVersion ) )
{
@ -282,77 +345,33 @@ public class PrepareReleaseMojo
rewriteScmConnection( model.getScm().getDeveloperConnection(), getTagLabel() ) );
}
try
{
Properties releaseProperties = new Properties();
releaseProperties.setProperty( "version", projectVersion );
releaseProperties.setProperty( USERNAME, username );
releaseProperties.setProperty( TAG, getTagLabel() );
releaseProperties.setProperty( SCM_URL, urlScm );
FileOutputStream os = new FileOutputStream( new File( project.getFile().getParentFile(), RELEASE_PROPS ) );
releaseProperties.store( os, "maven release plugin info" );
os.close();
}
catch ( IOException e )
{
throw new MojoExecutionException( "Cannote write release-version file.", e );
}
//Rewrite parent version
if ( project.hasParent() )
{
if ( isSnapshot( project.getParentArtifact().getBaseVersion() ) )
Artifact parentArtifact = project.getParentArtifact();
if ( isSnapshot( parentArtifact.getBaseVersion() ) )
{
model.getParent().setVersion( project.getParentArtifact().getVersion() );
String version = resolveVersion( parentArtifact, "parent" );
model.getParent().setVersion( version );
}
}
//Rewrite dependencies version
for ( Iterator i = project.getArtifacts().iterator(); i.hasNext(); )
//Rewrite dependencies section
Map artifactMap = ArtifactUtils.artifactMapByArtifactId( project.getArtifacts() );
for ( Iterator i = model.getDependencies().iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
if ( isSnapshot( artifact.getBaseVersion() ) )
{
for ( Iterator j = model.getDependencies().iterator(); j.hasNext(); )
{
Dependency dependency = (Dependency) j.next();
if ( artifact.getGroupId().equals( dependency.getGroupId() ) &&
artifact.getArtifactId().equals( dependency.getArtifactId() ) &&
artifact.getBaseVersion().equals( dependency.getVersion() ) &&
artifact.getType().equals( dependency.getType() ) )
{
dependency.setVersion( artifact.getVersion() );
}
}
}
Dependency dep = (Dependency) i.next();
String conflictId = ArtifactUtils.artifactId( dep.getGroupId(), dep.getArtifactId(), dep.getType(), dep.getVersion() );
Artifact artifact = (Artifact) artifactMap.get( conflictId );
dep.setVersion( artifact.getVersion() );
}
//Rewrite plugins version
for ( Iterator i = project.getPluginArtifacts().iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
if ( isSnapshot( artifact.getBaseVersion() ) )
{
for ( Iterator j = model.getBuild().getPlugins().iterator(); j.hasNext(); )
{
Plugin plugin = (Plugin) j.next();
if ( artifact.getGroupId().equals( plugin.getGroupId() ) &&
artifact.getArtifactId().equals( plugin.getArtifactId() ) )
{
plugin.setGroupId( artifact.getGroupId() );
plugin.setVersion( artifact.getVersion() );
}
}
}
}
try
{
PomTransformer transformer = new VersionTransformer();
@ -372,6 +391,154 @@ public class PrepareReleaseMojo
throw new MojoExecutionException( "Can't transform pom to its release version form.", e );
}
}
private void generateReleasePom() throws MojoExecutionException
{
MavenProject releaseProject = new MavenProject( project );
Model releaseModel = releaseProject.getModel();
//Rewrite parent version
if ( project.hasParent() )
{
Artifact parentArtifact = project.getParentArtifact();
if ( isSnapshot( parentArtifact.getBaseVersion() ) )
{
String version = resolveVersion( parentArtifact, "parent" );
model.getParent().setVersion( version );
}
}
//Rewrite dependencies section
List newdeps = new ArrayList();
for ( Iterator i = releaseProject.getArtifacts().iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
Dependency newdep = new Dependency();
newdep.setArtifactId( artifact.getArtifactId() );
newdep.setGroupId( artifact.getGroupId() );
newdep.setVersion( artifact.getVersion() );
newdep.setType( artifact.getType() );
newdep.setScope( artifact.getScope() );
newdeps.add( newdep );
}
releaseModel.setDependencies( newdeps );
//Rewrite plugins version
for ( Iterator i = releaseProject.getPluginArtifacts().iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
if ( isSnapshot( artifact.getBaseVersion() ) )
{
for ( Iterator j = releaseModel.getBuild().getPlugins().iterator(); j.hasNext(); )
{
Plugin plugin = (Plugin) j.next();
if ( ArtifactUtils.versionlessKey(artifact).equals( plugin.getKey() ) )
{
String version = resolveVersion( artifact, "plugin" );
plugin.setGroupId( artifact.getGroupId() );
plugin.setVersion( version );
}
}
}
}
//Rewrite report version
for ( Iterator i = releaseProject.getReportArtifacts().iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
if ( isSnapshot( artifact.getBaseVersion() ) )
{
List reportPlugins = releaseProject.getReportPlugins();
if ( reportPlugins != null )
{
for ( Iterator j = reportPlugins.iterator(); j.hasNext(); )
{
ReportPlugin plugin = (ReportPlugin) j.next();
if ( ArtifactUtils.versionlessKey(artifact).equals( plugin.getKey() ) )
{
String version = resolveVersion( artifact, "report" );
plugin.setGroupId( artifact.getGroupId() );
plugin.setVersion( version );
}
}
}
}
}
File releasePomFile = new File( basedir, RELEASE_POM );
Writer writer = null;
try
{
writer = new FileWriter( releasePomFile );
releaseProject.writeModel( writer );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Cannot write release-pom to: " + releasePomFile, e );
}
finally
{
IOUtil.close( writer );
}
try
{
ScmBean scm = getScm();
scm.setWorkingDirectory( basedir );
List scmChanges = scm.getStatus();
for ( Iterator i = scmChanges.iterator(); i.hasNext(); )
{
ScmFile f = (ScmFile) i.next();
if ( f.getPath().equals( "release-pom.xml" ) && f.getStatus() != ScmFileStatus.MODIFIED )
{
getScm().add( RELEASE_POM );
}
}
}
catch ( ScmException e )
{
throw new MojoExecutionException( "Error updating the release-pom.xml.", e );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error updating the release-pom.xml.", e );
}
}
private String resolveVersion( Artifact artifact, String artifactUsage )
throws MojoExecutionException
{
if ( artifact.getFile() == null )
{
try
{
artifactMetadataSource.retrieve(artifact, localRepository, project.getPluginArtifactRepositories() );
}
catch ( ArtifactMetadataRetrievalException e )
{
throw new MojoExecutionException( "Cannot resolve " + artifactUsage + ": " + artifact.getId(), e );
}
}
return artifact.getVersion();
}
private void transformPomToSnapshotVersionPom()
throws MojoExecutionException
@ -401,9 +568,7 @@ public class PrepareReleaseMojo
{
getLog().info( "What is the new version? [" + projectVersion + "]" );
InputHandler handler = (InputHandler) getContainer().lookup( InputHandler.ROLE );
String inputVersion = handler.readLine();
String inputVersion = inputHandler.readLine();
if ( !StringUtils.isEmpty( inputVersion ) )
{
@ -449,16 +614,16 @@ public class PrepareReleaseMojo
private void checkInReleaseVersionPom()
throws MojoExecutionException
{
checkInPom( "[maven-release-plugin] prepare release " + projectVersion );
checkIn( "pom.xml,release-pom.xml", "[maven-release-plugin] prepare release " + projectVersion );
}
private void checkInSnapshotVersionPom()
throws MojoExecutionException
{
checkInPom( "[maven-release-plugin] prepare for development " + projectVersion );
checkIn( "pom.xml", "[maven-release-plugin] prepare for development " + projectVersion );
}
private void checkInPom( String message )
private void checkIn( String includePattern, String message )
throws MojoExecutionException
{
try
@ -472,7 +637,7 @@ public class PrepareReleaseMojo
// No tag here - we suppose user works on correct branch
scm.setTag( null );
scm.checkin( message, "pom.xml", null );
scm.checkin( message, includePattern, null );
scm.setTag( tag );
}
@ -508,9 +673,7 @@ public class PrepareReleaseMojo
{
getLog().info( "What tag name should be used? [ " + tag + " ]" );
InputHandler handler = (InputHandler) getContainer().lookup( InputHandler.ROLE );
String inputTag = handler.readLine();
String inputTag = inputHandler.readLine();
if ( !StringUtils.isEmpty( inputTag ) )
{

View File

@ -21,6 +21,7 @@ import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.command.add.AddScmResult;
import org.apache.maven.scm.command.checkin.CheckInScmResult;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.command.status.StatusScmResult;
@ -174,6 +175,17 @@ public class ScmBean
return changedFiles;
}
public void add( String file ) throws ScmException, IOException
{
ScmRepository repository = getScmRepository();
ScmFileSet fs = new ScmFileSet( new File( workingDirectory ), file, null );
AddScmResult result = getScmManager().add(repository, fs);
checkResult( result );
}
public void checkin( String message, String includes, String excludes )
throws Exception

View File

@ -16,7 +16,6 @@ package org.apache.maven.doxia;
* limitations under the License.
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.ReportPlugin;
@ -30,7 +29,6 @@ import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.i18n.I18N;
import org.codehaus.plexus.siterenderer.Renderer;
import org.codehaus.plexus.siterenderer.RendererException;
@ -100,13 +98,6 @@ public class DoxiaMojo
// Mac
"**/.DS_Store"};
/**
* @parameter expression="${settings}"
* @required
* @readonly
*/
private Settings settings;
/**
* @parameter expression="${basedir}/src/site"
* @required
@ -179,13 +170,6 @@ public class DoxiaMojo
*/
private PluginManager pluginManager;
/**
* @parameter expression="${localRepository}"
* @required
* @readonly
*/
private ArtifactRepository localRepository;
/**
* @parameter expression="${session}"
* @required
@ -916,7 +900,7 @@ public class DoxiaMojo
if ( reportSets == null || reportSets.isEmpty() )
{
reportsList = pluginManager.getReports( reportPlugin, null, project, session, localRepository );
reportsList = pluginManager.getReports( reportPlugin, null, project, session );
}
else
@ -925,8 +909,7 @@ public class DoxiaMojo
{
ReportSet reportSet = (ReportSet) j.next();
reportsList = pluginManager.getReports( reportPlugin, reportSet, project, session,
localRepository );
reportsList = pluginManager.getReports( reportPlugin, reportSet, project, session );
}
}

View File

@ -34,6 +34,7 @@ import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.Profile;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.Repository;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.profiles.activation.ProfileActivationCalculator;
@ -85,14 +86,16 @@ public class DefaultMavenProjectBuilder
// TODO: remove
private PlexusContainer container;
private ArtifactResolver artifactResolver;
protected ArtifactResolver artifactResolver;
protected ArtifactMetadataSource artifactMetadataSource;
private ArtifactFactory artifactFactory;
private ModelInheritanceAssembler modelInheritanceAssembler;
private ModelValidator validator;
// TODO: make it a component
private MavenXpp3Reader modelReader;
@ -125,22 +128,6 @@ public class DefaultMavenProjectBuilder
public MavenProject buildWithDependencies( File projectDescriptor, ArtifactRepository localRepository,
List externalProfiles )
throws ProjectBuildingException, ArtifactResolutionException
{
ArtifactMetadataSource source;
try
{
source = (ArtifactMetadataSource) container.lookup( ArtifactMetadataSource.ROLE );
}
catch ( ComponentLookupException e )
{
throw new ProjectBuildingException( "Unable to get the artifact metadata source component", e );
}
return buildWithDependencies( projectDescriptor, localRepository, source, externalProfiles );
}
public MavenProject buildWithDependencies( File projectDescriptor, ArtifactRepository localRepository,
ArtifactMetadataSource artifactMetadataSource, List externalProfiles )
throws ProjectBuildingException, ArtifactResolutionException
{
MavenProject project = buildFromSourceFile( projectDescriptor, localRepository, externalProfiles );
@ -160,6 +147,9 @@ public class DefaultMavenProjectBuilder
Artifact projectArtifact = project.getArtifact();
Map managedVersions = createManagedVersionMap( project.getDependencyManagement() );
ensureMetadataSourceIsInitialized();
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getDependencyArtifacts(),
projectArtifact, managedVersions,
localRepository,
@ -169,6 +159,22 @@ public class DefaultMavenProjectBuilder
project.setArtifacts( result.getArtifacts() );
return project;
}
private void ensureMetadataSourceIsInitialized()
throws ProjectBuildingException
{
if ( artifactMetadataSource == null )
{
try
{
artifactMetadataSource = (ArtifactMetadataSource) container.lookup( ArtifactMetadataSource.ROLE );
}
catch ( ComponentLookupException e )
{
throw new ProjectBuildingException( "Cannot lookup metadata source for building the project.", e );
}
}
}
private Map createManagedVersionMap( DependencyManagement dependencyManagement )
throws ProjectBuildingException
@ -330,10 +336,14 @@ public class DefaultMavenProjectBuilder
}
}
Model originalModel = ModelUtils.cloneModel( model );
List repositories = new ArrayList( aggregatedRemoteWagonRepositories );
MavenProject project = assembleLineage( model, lineage, repositories, localRepository );
project.setOriginalModel( originalModel );
// we don't have to force the collision exception for superModel here, it's already been done in getSuperModel()
Model previous = superModel;
@ -636,6 +646,48 @@ public class DefaultMavenProjectBuilder
return pluginArtifacts;
}
protected Set createReportArtifacts( List reports )
throws ProjectBuildingException
{
Set pluginArtifacts = new HashSet();
if ( reports != null )
{
for ( Iterator i = reports.iterator(); i.hasNext(); )
{
ReportPlugin p = (ReportPlugin) i.next();
String version;
if ( StringUtils.isEmpty( p.getVersion() ) )
{
version = "RELEASE";
}
else
{
version = p.getVersion();
}
Artifact artifact = null;
try
{
artifact = artifactFactory.createPluginArtifact( p.getGroupId(), p.getArtifactId(), VersionRange
.createFromVersionSpec( version ) );
}
catch ( InvalidVersionSpecificationException e )
{
throw new ProjectBuildingException( "Unable to parse plugin version", e );
}
if ( artifact != null )
{
pluginArtifacts.add( artifact );
}
}
}
return pluginArtifacts;
}
public MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository, List externalProfiles )
throws ProjectBuildingException
{

View File

@ -111,6 +111,14 @@ public class MavenProject
// calculated.
private Map artifactMap;
private Model originalModel;
private Map pluginArtifactMap;
private Set reportArtifacts;
private Map reportArtifactMap;
public MavenProject( Model model )
{
this.model = model;
@ -810,7 +818,7 @@ public class MavenProject
{
if ( artifactMap == null )
{
artifactMap = ArtifactUtils.artifactMap( getArtifacts() );
artifactMap = ArtifactUtils.artifactMapByVersionlessId( getArtifacts() );
}
return artifactMap;
@ -825,6 +833,36 @@ public class MavenProject
{
return pluginArtifacts;
}
public Map getPluginArtifactMap()
{
if ( pluginArtifactMap == null )
{
pluginArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getPluginArtifacts() );
}
return pluginArtifactMap;
}
public void setReportArtifacts( Set reportArtifacts )
{
this.reportArtifacts = reportArtifacts;
}
public Set getReportArtifacts()
{
return reportArtifacts;
}
public Map getReportArtifactMap()
{
if ( reportArtifactMap == null )
{
reportArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getReportArtifacts() );
}
return reportArtifactMap;
}
public void setParentArtifact( Artifact parentArtifact )
{
@ -1096,6 +1134,14 @@ public class MavenProject
pomWriter.write( writer, getModel() );
}
public void writeOriginalModel( Writer writer )
throws IOException
{
MavenXpp3Writer pomWriter = new MavenXpp3Writer();
pomWriter.write( writer, getOriginalModel() );
}
public Set getDependencyArtifacts()
{
return dependencyArtifacts;
@ -1105,4 +1151,38 @@ public class MavenProject
{
this.dependencyArtifacts = dependencyArtifacts;
}
public void setOriginalModel( Model originalModel )
{
this.originalModel = originalModel;
}
public Model getOriginalModel()
{
return originalModel;
}
public boolean equals( Object other )
{
if ( other == this )
{
return true;
}
else if ( !( other instanceof MavenProject ) )
{
return false;
}
else
{
MavenProject otherProject = (MavenProject) other;
return getId().equals( otherProject.getId() );
}
}
public int hashCode()
{
return getId().hashCode();
}
}

View File

@ -17,7 +17,6 @@ package org.apache.maven.project;
*/
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
@ -37,10 +36,6 @@ public interface MavenProjectBuilder
MavenProject build( File project, ArtifactRepository localRepository, List profiles )
throws ProjectBuildingException;
MavenProject buildWithDependencies( File project, ArtifactRepository localRepository,
ArtifactMetadataSource artifactMetadataSource, List externalProfiles )
throws ProjectBuildingException, ArtifactResolutionException;
MavenProject buildWithDependencies( File project, ArtifactRepository localRepository, List externalProfiles )
throws ProjectBuildingException, ArtifactResolutionException;

View File

@ -49,6 +49,9 @@ public class MavenMetadataSource
extends AbstractLogEnabled
implements ArtifactMetadataSource
{
public static final String ROLE_HINT = "maven";
private MavenProjectBuilder mavenProjectBuilder;
private ArtifactFactory artifactFactory;

View File

@ -114,6 +114,7 @@
<role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
<implementation>org.apache.maven.project.inheritance.DefaultModelInheritanceAssembler</implementation>
</component>
<!--
|
|
@ -124,8 +125,28 @@
<implementation>org.apache.maven.project.validation.DefaultModelValidator</implementation>
</component>
<!-- ********************* FIXME *******************************************
| I realize this is duplicated but allows the project builder to work by itself
-->
<component>
<role>org.apache.maven.project.path.PathTranslator</role>
<implementation>org.apache.maven.project.path.DefaultPathTranslator</implementation>
</component>
<component>
<role>org.apache.maven.project.ModelResolver</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.project.ModelResolver</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
<role-hint>maven</role-hint>
<implementation>org.apache.maven.project.artifact.MavenMetadataSource</implementation>
<requirements>
<requirement>
@ -136,13 +157,5 @@
</requirement>
</requirements>
</component>
<!-- ********************* FIXME *******************************************
| I realize this is duplicated but allows the project builder to work by itself
-->
<component>
<role>org.apache.maven.project.path.PathTranslator</role>
<implementation>org.apache.maven.project.path.DefaultPathTranslator</implementation>
</component>
</components>
</component-set>

View File

@ -16,12 +16,11 @@ package org.apache.maven.project;
* limitations under the License.
*/
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import java.io.File;
import java.io.FileNotFoundException;
@ -37,18 +36,22 @@ public abstract class MavenProjectTestCase
{
protected MavenProjectBuilder projectBuilder;
private ArtifactFactory artifactFactory;
private ArtifactRepositoryFactory artifactRepositoryFactory;
protected void setUp()
throws Exception
{
super.setUp();
projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
artifactRepositoryFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
try
{
projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE, "test" );
}
catch ( ComponentLookupException e )
{
// default over to the main project builder...
projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
}
System.out.println("Using project builder: " + projectBuilder.getClass().getName() + " for tests in: " + getClass().getName());
}
// ----------------------------------------------------------------------
@ -103,8 +106,7 @@ public abstract class MavenProjectTestCase
protected MavenProject getProjectWithDependencies( File pom )
throws Exception
{
return projectBuilder.buildWithDependencies( pom, getLocalRepository(), new TestArtifactResolver.Source(
artifactFactory, artifactRepositoryFactory, getContainer() ), Collections.EMPTY_LIST );
return projectBuilder.buildWithDependencies( pom, getLocalRepository(), Collections.EMPTY_LIST );
}
protected MavenProject getProject( File pom )

View File

@ -19,7 +19,6 @@ package org.apache.maven.project;
import org.apache.maven.artifact.Artifact;
import java.io.File;
import java.lang.reflect.Field;
import java.util.Iterator;
/**
@ -35,16 +34,14 @@ public class ProjectClasspathTest
{
File f = getFileForClasspathResource( dir + "project-with-scoped-dependencies.xml" );
// XXX: Because this test fails, we resort to crude reflection hacks, see PLX-108 for the solution
// assertEquals( TestArtifactResolver.class, getContainer().lookup( ArtifactResolver.ROLE ).getClass() );
MavenProjectBuilder builder = (MavenProjectBuilder) getContainer().lookup( MavenProjectBuilder.ROLE );
Field declaredField = builder.getClass().getDeclaredField( "artifactResolver" );
boolean acc = declaredField.isAccessible();
declaredField.setAccessible( true );
declaredField.set( builder, getContainer().lookup( TestArtifactResolver.class.getName() ) );
declaredField.setAccessible( acc );
// XXX: end hack
TestProjectBuilder builder = (TestProjectBuilder) getContainer().lookup( MavenProjectBuilder.ROLE, "test" );
TestArtifactResolver testArtifactResolver = (TestArtifactResolver) getContainer().lookup( TestArtifactResolver.class.getName() );
builder.setArtifactResolver( testArtifactResolver );
builder.setArtifactMetadataSource( testArtifactResolver.source() );
MavenProject project = getProjectWithDependencies( f );
Artifact artifact;

View File

@ -52,6 +52,8 @@ public class TestArtifactResolver
extends DefaultArtifactResolver
implements Contextualizable
{
public static final String ROLE = TestArtifactResolver.class.getName();
private ArtifactRepositoryFactory repositoryFactory;
private PlexusContainer container;
@ -155,6 +157,11 @@ public class TestArtifactResolver
return projectArtifacts;
}
}
public Source source()
{
return new Source( artifactFactory, repositoryFactory, container );
}
/**
* @noinspection RefusedBequest

View File

@ -0,0 +1,18 @@
package org.apache.maven.project;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.resolver.ArtifactResolver;
public class TestProjectBuilder extends DefaultMavenProjectBuilder
{
public void setArtifactResolver( ArtifactResolver resolver )
{
artifactResolver = resolver;
}
public void setArtifactMetadataSource( ArtifactMetadataSource metadataSource )
{
artifactMetadataSource = metadataSource;
}
}

View File

@ -32,5 +32,39 @@
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.project.MavenProjectBuilder</role>
<role-hint>test</role-hint>
<implementation>org.apache.maven.project.TestProjectBuilder</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
</requirement>
<requirement>
<role>org.apache.maven.project.interpolation.ModelInterpolator</role>
</requirement>
<requirement>
<role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
</requirement>
<requirement>
<role>org.apache.maven.project.validation.ModelValidator</role>
</requirement>
<requirement>
<role>org.apache.maven.project.path.PathTranslator</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.profiles.activation.ProfileActivationCalculator</role>
</requirement>
</requirements>
</component>
</components>
</plexus>