o lifecycle executor now strictly deals with plugins, and is 500 lines (still needs to be smaller) and is getting

a lot more efficient 


git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@757293 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-03-23 01:27:27 +00:00
parent 1fa49f1ae0
commit 7b6b911ed3
11 changed files with 283 additions and 538 deletions

View File

@ -111,7 +111,7 @@ public class MavenSession
return request.getLocalRepository();
}
public List getGoals()
public List<String> getGoals()
{
return request.getGoals();
}

View File

@ -18,36 +18,25 @@ package org.apache.maven.lifecycle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import org.apache.maven.BuildFailureException;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.lifecycle.mapping.LifecycleMapping;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.ReportSet;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.InvalidPluginException;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.PluginConfigurationException;
import org.apache.maven.plugin.PluginLoaderException;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.PluginManagerException;
import org.apache.maven.plugin.PluginNotFoundException;
import org.apache.maven.plugin.PluginVersionNotFoundException;
import org.apache.maven.plugin.PluginVersionResolutionException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.MavenReport;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
@ -68,8 +57,6 @@ public class DefaultLifecycleExecutor
private List<Lifecycle> lifecycles;
private List defaultReports;
private Map<String, Lifecycle> phaseToLifecycleMap;
@Requirement
@ -89,7 +76,7 @@ public class DefaultLifecycleExecutor
// within the same reactor (using an inclusion pattern to gather them up)...
MavenProject rootProject = rm.getTopLevelProject();
List goals = session.getGoals();
List<String> goals = session.getGoals();
if ( goals.isEmpty() && rootProject != null )
{
@ -115,7 +102,7 @@ public class DefaultLifecycleExecutor
{
if ( lifecycle.getId().equals( "default" ) )
{
return (List<String>) lifecycle.getPhases().values();
return (List<String>) lifecycle.getPhases();
}
}
@ -283,6 +270,8 @@ public class DefaultLifecycleExecutor
// 1. Find the lifecycle given the phase (default lifecycle when given install)
// 2. Find the lifecycle mapping that corresponds to the project packaging (jar lifecycle mapping given the jar packaging)
// 3. Find the mojos associated with the lifecycle given the project packaging (jar lifecycle mapping for the default lifecycle)
// 4. Bind those mojos found in the lifecycle mapping for the packaging to the lifecycle
// 5. Bind mojos specified in the project itself to the lifecycle
private void executeGoal( String task, MavenSession session, MavenProject project )
throws LifecycleExecutionException, BuildFailureException
{
@ -290,91 +279,83 @@ public class DefaultLifecycleExecutor
Lifecycle lifecycle = phaseToLifecycleMap.get( task );
// 2.
LifecycleMapping mapping = lifecycleMappings.get( project.getPackaging() );
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( project.getPackaging() );
// 3.
Map<String,String> lifecyclePhases = mapping.getLifecycles().get( "default" ).getPhases();
Map<String, String> lifecyclePhasesForPackaging = lifecycleMappingForPackaging.getLifecycles().get( "default" ).getPhases();
for( String phase : lifecycle.getPhases().values() )
{
System.out.println( ">> " + phase );
// Create an order Map of the phases in the lifecycle to a list of mojos to execute.
Map<String,List<String>> phaseToMojoMapping = new LinkedHashMap<String,List<String>>();
// 4.
for ( String phase : lifecycle.getPhases() )
{
List<String> mojos = new ArrayList<String>();
// Bind the mojos in the lifecycle mapping for the packaging to the lifecycle itself. If
// we can find the specified phase in the packaging them grab those mojos and add them to
// the list we are going to execute.
String mojo = lifecyclePhasesForPackaging.get( phase );
if ( mojo != null )
{
mojos.add( mojo );
}
phaseToMojoMapping.put( phase, mojos );
// We only want to execute up to and including the specified lifecycle phase.
if ( phase.equals( task ) )
{
break;
}
}
// 5.
for( Plugin plugin : project.getBuild().getPlugins() )
{
for( PluginExecution execution : plugin.getExecutions() )
{
// if the phase is specified then I don't have to go fetch the plugin yet and pull it down
// to examine the phase it is associated to.
if ( execution.getPhase() != null )
{
for( String goal : execution.getGoals() )
{
String s = plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() + ":" + goal;
phaseToMojoMapping.get( execution.getPhase() ).add( s );
}
}
// if not then i need to grab the mojo descriptor and look at
// the phase that is specified
else
{
for( String goal : execution.getGoals() )
{
String s = plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() + ":" + goal;
MojoDescriptor md = getMojoDescriptor( s, session, project);
phaseToMojoMapping.get( md.getPhase() ).add( s );
}
}
}
}
// We need to turn this into a set of MojoExecutions
for( List<String> mojos : phaseToMojoMapping.values() )
{
for( String mojo : mojos )
{
System.out.println( ">> " + mojo );
}
}
/*
try
{
if ( lifecycle != null )
{
Map lifecycleMappings = constructLifecycleMappings( session, task, project, lifecycle );
executeGoalWithLifecycle( task, session, lifecycleMappings, project, lifecycle );
}
else
{
executeStandaloneGoal( task, session, project );
}
}
catch ( PluginNotFoundException e )
{
throw new BuildFailureException( "A required plugin was not found: " + e.getMessage(), e );
}
*/
}
/*
private void executeGoalWithLifecycle( String task, MavenSession session, Map lifecycleMappings, MavenProject project, Lifecycle lifecycle )
throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
{
List goals = new ArrayList();
// only execute up to the given phase
int index = lifecycle.getPhases().indexOf( task );
for ( int i = 0; i <= index; i++ )
{
String p = (String) lifecycle.getPhases().get( i );
List phaseGoals = (List) lifecycleMappings.get( p );
if ( phaseGoals != null )
{
goals.addAll( phaseGoals );
}
}
if ( !goals.isEmpty() )
{
executeGoals( goals, session, project );
}
else
{
getLogger().info( "No goals needed for project - skipping" );
}
}
*/
private void executeStandaloneGoal( String task, MavenSession session, MavenProject project )
throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
{
// guaranteed to come from the CLI and not be part of a phase
MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session, project );
executeGoals( Collections.singletonList( new MojoExecution( mojoDescriptor ) ), session, project );
}
private void executeGoals( List<MojoExecution> goals, MavenSession session, MavenProject project )
throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
{
for ( MojoExecution mojoExecution : goals )
for ( MojoExecution mojoExecution : goals )
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
if ( mojoDescriptor.isRequiresReports() )
{
List reports = getReports( project, mojoExecution, session );
mojoExecution.setReports( reports );
}
try
{
pluginManager.executeMojo( project, mojoExecution, session );
@ -391,356 +372,10 @@ public class DefaultLifecycleExecutor
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
}
}
*/
}
private List getReports( MavenProject project, MojoExecution mojoExecution, MavenSession session )
throws LifecycleExecutionException, PluginNotFoundException
{
List reportPlugins = project.getReportPlugins();
if ( project.getModel().getReports() != null )
{
getLogger().error( "Plugin contains a <reports/> section: this is IGNORED - please use <reporting/> instead." );
}
if ( project.getReporting() == null || !project.getReporting().isExcludeDefaults() )
{
if ( reportPlugins == null )
{
reportPlugins = new ArrayList();
}
else
{
reportPlugins = new ArrayList( reportPlugins );
}
for ( Iterator i = defaultReports.iterator(); i.hasNext(); )
{
String report = (String) i.next();
StringTokenizer tok = new StringTokenizer( report, ":" );
int count = tok.countTokens();
if ( count != 2 && count != 3 )
{
getLogger().warn( "Invalid default report ignored: '" + report + "' (must be groupId:artifactId[:version])" );
}
else
{
String groupId = tok.nextToken();
String artifactId = tok.nextToken();
String version = tok.hasMoreTokens() ? tok.nextToken() : null;
boolean found = false;
for ( Iterator j = reportPlugins.iterator(); j.hasNext() && !found; )
{
ReportPlugin reportPlugin = (ReportPlugin) j.next();
if ( reportPlugin.getGroupId().equals( groupId ) && reportPlugin.getArtifactId().equals( artifactId ) )
{
found = true;
}
}
if ( !found )
{
ReportPlugin reportPlugin = new ReportPlugin();
reportPlugin.setGroupId( groupId );
reportPlugin.setArtifactId( artifactId );
reportPlugin.setVersion( version );
reportPlugins.add( reportPlugin );
}
}
}
}
List reports = new ArrayList();
if ( reportPlugins != null )
{
for ( Iterator it = reportPlugins.iterator(); it.hasNext(); )
{
ReportPlugin reportPlugin = (ReportPlugin) it.next();
List reportSets = reportPlugin.getReportSets();
if ( reportSets == null || reportSets.isEmpty() )
{
reports.addAll( getReports( reportPlugin, null, project, session, mojoExecution ) );
}
else
{
for ( Iterator j = reportSets.iterator(); j.hasNext(); )
{
ReportSet reportSet = (ReportSet) j.next();
reports.addAll( getReports( reportPlugin, reportSet, project, session, mojoExecution ) );
}
}
}
}
return reports;
}
private List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session, MojoExecution mojoExecution )
throws LifecycleExecutionException, PluginNotFoundException
{
PluginDescriptor pluginDescriptor = loadReport( reportPlugin, project, session );
List reports = new ArrayList();
for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
{
MojoDescriptor mojoDescriptor = (MojoDescriptor) i.next();
// TODO: check ID is correct for reports
// if the POM configured no reports, give all from plugin
if ( reportSet == null || reportSet.getReports().contains( mojoDescriptor.getGoal() ) )
{
String id = null;
if ( reportSet != null )
{
id = reportSet.getId();
}
MojoExecution reportExecution = new MojoExecution( mojoDescriptor, id );
try
{
MavenReport reportMojo = pluginManager.getReport( project, reportExecution, session );
// Comes back null if it was a plugin, not a report - these are mojos in the reporting plugins that are not reports
if ( reportMojo != null )
{
reports.add( reportMojo );
mojoExecution.addMojoExecution( reportExecution );
}
}
catch ( PluginManagerException e )
{
throw new LifecycleExecutionException( "Error getting reports from the plugin '" + reportPlugin.getKey() + "': " + e.getMessage(), e );
}
catch ( PluginConfigurationException e )
{
throw new LifecycleExecutionException( "Error getting reports from the plugin '" + reportPlugin.getKey() + "'", e );
}
catch ( ArtifactNotFoundException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( ArtifactResolutionException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
}
}
return reports;
}
/*
private Map constructLifecycleMappings( MavenSession session, String selectedPhase, MavenProject project, Lifecycle lifecycle )
throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
{
// first, bind those associated with the packaging
Map lifecycleMappings = bindLifecycleForPackaging( session, selectedPhase, project, lifecycle );
// next, loop over plugins and for any that have a phase, bind it
for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
{
Plugin plugin = (Plugin) i.next();
bindPluginToLifecycle( plugin, session, lifecycleMappings, project );
}
return lifecycleMappings;
}
*/
/*
private Map bindLifecycleForPackaging( MavenSession session, String selectedPhase, MavenProject project, Lifecycle lifecycle )
throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
{
Map mappings = findMappingsForLifecycle( session, project, lifecycle );
Map lifecycleMappings = new HashMap();
for ( Iterator i = lifecycle.getPhases().iterator(); i.hasNext(); )
{
String phase = (String) i.next();
String phaseTasks = (String) mappings.get( phase );
if ( phaseTasks != null )
{
for ( StringTokenizer tok = new StringTokenizer( phaseTasks, "," ); tok.hasMoreTokens(); )
{
String goal = tok.nextToken().trim();
// Not from the CLI, don't use prefix
MojoDescriptor mojoDescriptor = getMojoDescriptor( goal, session, project );
if ( mojoDescriptor == null )
{
continue;
}
if ( mojoDescriptor.isDirectInvocationOnly() )
{
throw new LifecycleExecutionException( "Mojo: \'" + goal + "\' requires direct invocation. It cannot be used as part of lifecycle: \'" + project.getPackaging() + "\'." );
}
addToLifecycleMappings( lifecycleMappings, phase, new MojoExecution( mojoDescriptor ), session );
}
}
if ( phase.equals( selectedPhase ) )
{
break;
}
}
return lifecycleMappings;
}
*/
private Map findMappingsForLifecycle( MavenSession session, MavenProject project, Lifecycle lifecycle )
throws LifecycleExecutionException, PluginNotFoundException
{
String packaging = project.getPackaging();
Map mappings = null;
LifecycleMapping m;
Map defaultMappings = lifecycle.getDefaultPhases();
if ( mappings == null )
{
m = lifecycleMappings.get( packaging );
mappings = null; //m.getLifecycles().get( lifecycle.getId() );
}
if ( mappings == null )
{
if ( defaultMappings == null )
{
throw new LifecycleExecutionException( "Cannot find lifecycle mapping for packaging: \'" + packaging + "\', and there is no default" );
}
else
{
mappings = defaultMappings;
}
}
return mappings;
}
/**
* Take each mojo contained with a plugin, look to see whether it contributes to a phase in the
* lifecycle and if it does place it at the end of the list of goals to execute for that given
* phase.
*
* @param project
* @param session
* @throws PluginVersionNotFoundException
* @throws PluginManagerException
* @throws InvalidPluginException
* @throws PluginVersionResolutionException
* @throws ArtifactNotFoundException
* @throws ArtifactResolutionException
*/
private void bindPluginToLifecycle( Plugin plugin, MavenSession session, Map phaseMap, MavenProject project )
throws LifecycleExecutionException
{
PluginDescriptor pluginDescriptor = loadPlugin( plugin, project, session );
if ( pluginDescriptor.getMojos() != null && !pluginDescriptor.getMojos().isEmpty() )
{
// use the plugin if inherit was true in a base class, or it is in the current POM, otherwise use the default inheritence setting
if ( plugin.isInheritanceApplied() || pluginDescriptor.isInheritedByDefault() )
{
if ( plugin.getGoals() != null )
{
getLogger().error( "Plugin contains a <goals/> section: this is IGNORED - please use <executions/> instead." );
}
List executions = plugin.getExecutions();
if ( executions != null )
{
for ( Iterator it = executions.iterator(); it.hasNext(); )
{
PluginExecution execution = (PluginExecution) it.next();
bindExecutionToLifecycle( pluginDescriptor, phaseMap, execution, session );
}
}
}
}
}
private void bindExecutionToLifecycle( PluginDescriptor pluginDescriptor, Map phaseMap, PluginExecution execution, MavenSession session )
throws LifecycleExecutionException
{
for ( Iterator i = execution.getGoals().iterator(); i.hasNext(); )
{
String goal = (String) i.next();
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
if ( mojoDescriptor == null )
{
throw new LifecycleExecutionException( "'" + goal + "' was specified in an execution, but not found in the plugin" );
}
// We have to check to see that the inheritance rules have been applied before binding this mojo.
if ( execution.isInheritanceApplied() || mojoDescriptor.isInheritedByDefault() )
{
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, execution.getId() );
String phase = execution.getPhase();
if ( phase == null )
{
// if the phase was not in the configuration, use the phase in the descriptor
phase = mojoDescriptor.getPhase();
}
if ( phase != null )
{
if ( mojoDescriptor.isDirectInvocationOnly() )
{
throw new LifecycleExecutionException( "Mojo: \'" + goal + "\' requires direct invocation. It cannot be used as part of the lifecycle (it was included via the POM)." );
}
addToLifecycleMappings( phaseMap, phase, mojoExecution, session );
}
}
}
}
private void addToLifecycleMappings( Map lifecycleMappings, String phase, MojoExecution mojoExecution, MavenSession session )
{
List goals = (List) lifecycleMappings.get( phase );
if ( goals == null )
{
goals = new ArrayList();
lifecycleMappings.put( phase, goals );
}
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
if ( session.isOffline() && mojoDescriptor.isOnlineRequired() )
{
String goal = mojoDescriptor.getGoal();
getLogger().warn( goal + " requires online mode, but maven is currently offline. Disabling " + goal + "." );
}
else
{
goals.add( mojoExecution );
}
}
// all this logic should go to the plugin manager
MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project )
throws LifecycleExecutionException
{
@ -749,7 +384,7 @@ public class DefaultLifecycleExecutor
StringTokenizer tok = new StringTokenizer( task, ":" );
int numTokens = tok.countTokens();
if ( numTokens == 2 )
{
String prefix = tok.nextToken();
@ -769,10 +404,8 @@ public class DefaultLifecycleExecutor
// Search plugin in the current POM
if ( plugin == null )
{
for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
for ( Plugin buildPlugin : project.getBuildPlugins() )
{
Plugin buildPlugin = (Plugin) i.next();
PluginDescriptor desc = loadPlugin( buildPlugin, project, session );
if ( prefix.equals( desc.getGoalPrefix() ) )
@ -803,10 +436,8 @@ public class DefaultLifecycleExecutor
if ( plugin.getVersion() == null )
{
for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
for ( Plugin buildPlugin : project.getBuildPlugins() )
{
Plugin buildPlugin = (Plugin) i.next();
if ( buildPlugin.getKey().equals( plugin.getKey() ) )
{
plugin = buildPlugin;
@ -845,35 +476,18 @@ public class DefaultLifecycleExecutor
}
}
private PluginDescriptor loadReport( ReportPlugin plugin, MavenProject project, MavenSession session )
throws LifecycleExecutionException
{
try
{
return pluginManager.loadReportPlugin( plugin, project, session );
}
catch ( PluginLoaderException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
}
public void initialize()
throws InitializationException
{
// If people are going to make their own lifecycles then we need to tell people how to namespace them correctly so
// that they don't interfere with internally defined lifecycles.
phaseToLifecycleMap = new HashMap();
phaseToLifecycleMap = new HashMap<String,Lifecycle>();
for ( Iterator i = lifecycles.iterator(); i.hasNext(); )
for ( Lifecycle lifecycle : lifecycles )
{
Lifecycle lifecycle = (Lifecycle) i.next();
for ( Iterator p = lifecycle.getPhases().values().iterator(); p.hasNext(); )
for ( String phase : lifecycle.getPhases() )
{
String phase = (String) p.next();
// The first definition wins.
if ( !phaseToLifecycleMap.containsKey( phase ) )
{

View File

@ -19,66 +19,31 @@ package org.apache.maven.lifecycle;
* under the License.
*/
import java.util.Map;
import java.util.List;
/**
* Class Lifecycle.
*/
public class Lifecycle
{
/**
* Field id
*/
private String id;
/**
* Field phases
*/
private Map<String,String> phases;
/**
* default phases.
*/
private Map defaultPhases;
private List<String> phases;
private List<String> defaultPhases;
/**
* Method getId
*/
public String getId()
{
return this.id;
}
/**
* Method getPhases
*/
public Map<String,String> getPhases()
public List<String> getPhases()
{
return this.phases;
}
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
}
/**
* Method setPhases
*
* @param phases
*/
public void setPhases( Map<String,String> phases )
{
this.phases = phases;
} //-- void setPhases(java.util.List)
public Map getDefaultPhases()
public List<String> getDefaultPhases()
{
return defaultPhases;
}
}
}

View File

@ -1,4 +1,4 @@
package org.apache.maven.lifecycle;
package org.apache.maven.lifecycle.mapping;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
@ -19,8 +19,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.maven.lifecycle.Lifecycle;
public class DefaultLifecycleMapping
implements LifecycleMapping
{

View File

@ -0,0 +1,84 @@
package org.apache.maven.lifecycle.mapping;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.Map;
/**
* Class Lifecycle.
*/
public class Lifecycle
{
/**
* Field id
*/
private String id;
/**
* Field phases
*/
private Map<String,String> phases;
/**
* default phases.
*/
private Map defaultPhases;
/**
* Method getId
*/
public String getId()
{
return this.id;
}
/**
* Method getPhases
*/
public Map<String,String> getPhases()
{
return this.phases;
}
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
}
/**
* Method setPhases
*
* @param phases
*/
public void setPhases( Map<String,String> phases )
{
this.phases = phases;
} //-- void setPhases(java.util.List)
public Map getDefaultPhases()
{
return defaultPhases;
}
}

View File

@ -1,4 +1,4 @@
package org.apache.maven.lifecycle;
package org.apache.maven.lifecycle.mapping;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -21,8 +21,6 @@ package org.apache.maven.lifecycle;
import java.util.Map;
import org.apache.maven.lifecycle.Lifecycle;
public interface LifecycleMapping
{
Map<String,Lifecycle> getLifecycles();

View File

@ -25,9 +25,9 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>pom</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
<lifecycle>
@ -58,9 +58,9 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>jar</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
<lifecycle>
@ -98,10 +98,10 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping
</role>
<role-hint>ejb</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
<configuration>
<lifecycles>
@ -160,9 +160,9 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>ejb3</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<!-- START SNIPPET: ejb3-lifecycle -->
<phases>
@ -215,9 +215,9 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>maven-plugin</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
<lifecycle>
@ -300,9 +300,9 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>war</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
<lifecycle>
@ -342,9 +342,9 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>ear</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
<lifecycle>
@ -381,9 +381,9 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>rar</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
<lifecycle>
@ -423,9 +423,9 @@ problem.
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>par</role-hint>
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<!-- START SNIPPET: par-lifecycle -->
<phases>

View File

@ -38,7 +38,7 @@ use a configuration source to pull in the lifecycle information.
<role>org.apache.maven.plugin.PluginManager</role>
</requirement>
<requirement>
<role>org.apache.maven.lifecycle.LifecycleMapping</role>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<field-name>lifecycleMappings</field-name>
</requirement>
</requirements>

View File

@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.lifecycle.test</groupId>
<artifactId>project-with-additional-lifecycle-elements</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>project-with-additional-lifecycle-elements</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>1.0-beta-3.0.6</version>
<executions>
<execution>
<goals>
<goal>generate-metadata</goal>
<goal>generate-test-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,13 @@
package org.apache.maven.lifecycle.test;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,38 @@
package org.apache.maven.lifecycle.test;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}