o adding in all plugins in all the default lifecycles

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@769547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-04-28 21:20:36 +00:00
parent d8e77e29b8
commit 6bca21c4f8
2 changed files with 35 additions and 18 deletions

View File

@ -193,25 +193,42 @@ private void executeGoal( String task, MavenSession session, MavenProject projec
}
}
public Set<Plugin> lifecyclePlugins( String lifecycleId, String packaging )
public Set<Plugin> lifecyclePlugins( String packaging )
{
Set<Plugin> plugins = new LinkedHashSet<Plugin>();
Lifecycle lifecycle = lifecycleMap.get( lifecycleId );
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
Map<String, String> lifecyclePhasesForPackaging = lifecycleMappingForPackaging.getLifecycles().get( lifecycleId ).getPhases();
for ( String s : lifecyclePhasesForPackaging.values() )
for ( Lifecycle lifecycle : lifecycles )
{
String[] p = StringUtils.split( s, ":" );
Plugin plugin = new Plugin();
plugin.setGroupId( p[0] );
plugin.setArtifactId( p[1] );
plugins.add( plugin );
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration = lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );
if ( lifecycleConfiguration != null )
{
Map<String, String> lifecyclePhasesForPackaging = lifecycleConfiguration.getPhases();
for ( String s : lifecyclePhasesForPackaging.values() )
{
String[] p = StringUtils.split( s, ":" );
Plugin plugin = new Plugin();
plugin.setGroupId( p[0] );
plugin.setArtifactId( p[1] );
plugins.add( plugin );
}
}
else if ( lifecycle.getDefaultPhases() != null )
{
for ( String s : lifecycle.getDefaultPhases() )
{
String[] p = StringUtils.split( s, ":" );
Plugin plugin = new Plugin();
plugin.setGroupId( p[0] );
plugin.setArtifactId( p[1] );
plugins.add( plugin );
}
}
}
return plugins;
}
@ -308,8 +325,7 @@ public List<MojoDescriptor> calculateLifecyclePlan( String lifecyclePhase, Maven
{
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

View File

@ -25,6 +25,7 @@
import org.apache.maven.BuildFailureException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.project.MavenProject;
@ -47,8 +48,8 @@ public interface LifecycleExecutor
List<MojoDescriptor> calculateLifecyclePlan( String lifecyclePhase, MavenSession session )
throws LifecycleExecutionException;
Set<Plugin> lifecyclePlugins( String lifecycleId, String packaging );
Set<Plugin> lifecyclePlugins( String packaging );
void execute( MavenSession session )
throws LifecycleExecutionException, MojoFailureException;
throws LifecycleExecutionException, MojoFailureException, MojoExecutionException;
}