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 @@ public class DefaultLifecycleExecutor
} }
} }
public Set<Plugin> lifecyclePlugins( String lifecycleId, String packaging ) public Set<Plugin> lifecyclePlugins( String packaging )
{ {
Set<Plugin> plugins = new LinkedHashSet<Plugin>(); Set<Plugin> plugins = new LinkedHashSet<Plugin>();
Lifecycle lifecycle = lifecycleMap.get( lifecycleId ); for ( Lifecycle lifecycle : lifecycles )
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
Map<String, String> lifecyclePhasesForPackaging = lifecycleMappingForPackaging.getLifecycles().get( lifecycleId ).getPhases();
for ( String s : lifecyclePhasesForPackaging.values() )
{ {
String[] p = StringUtils.split( s, ":" ); LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
Plugin plugin = new Plugin();
plugin.setGroupId( p[0] ); org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration = lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );
plugin.setArtifactId( p[1] );
plugins.add( plugin ); 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; return plugins;
} }
@ -308,8 +325,7 @@ public class DefaultLifecycleExecutor
{ {
String s = plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() + ":" + goal; String s = plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() + ":" + goal;
phaseToMojoMapping.get( execution.getPhase() ).add( s ); phaseToMojoMapping.get( execution.getPhase() ).add( s );
} }
} }
// if not then i need to grab the mojo descriptor and look at // if not then i need to grab the mojo descriptor and look at
// the phase that is specified // the phase that is specified

View File

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