mirror of
https://github.com/apache/maven.git
synced 2025-02-08 11:05:37 +00:00
MNG-4988 API to calculate execution plan without full mojo execution configuration
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1061589 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7bc1814003
commit
e8f8fdbadc
@ -25,7 +25,9 @@
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.*;
|
||||
import org.apache.maven.lifecycle.DefaultLifecycles;
|
||||
import org.apache.maven.lifecycle.LifecycleExecutor;
|
||||
import org.apache.maven.lifecycle.MavenExecutionPlan;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
@ -45,6 +47,11 @@ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String..
|
||||
return new MavenExecutionPlan( null, new DefaultLifecycles() );
|
||||
}
|
||||
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
|
||||
{
|
||||
return new MavenExecutionPlan( null, new DefaultLifecycles() );
|
||||
}
|
||||
|
||||
public void execute( MavenSession session )
|
||||
{
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -128,14 +129,14 @@ MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProjec
|
||||
// Used by m2eclipse
|
||||
|
||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
|
||||
PluginVersionResolutionException
|
||||
{
|
||||
|
||||
List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments( session );
|
||||
List<TaskSegment> taskSegments =
|
||||
lifecycleTaskSegmentCalculator.calculateTaskSegments( session, Arrays.asList( tasks ) );
|
||||
|
||||
TaskSegment mergedSegment = new TaskSegment( false );
|
||||
|
||||
@ -145,7 +146,16 @@ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String..
|
||||
}
|
||||
|
||||
return lifecycleExecutionPlanCalculator.calculateExecutionPlan( session, session.getCurrentProject(),
|
||||
mergedSegment.getTasks() );
|
||||
mergedSegment.getTasks(), setup );
|
||||
}
|
||||
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
|
||||
PluginVersionResolutionException
|
||||
{
|
||||
return calculateExecutionPlan( session, true, tasks );
|
||||
}
|
||||
|
||||
// Site 3.x
|
||||
|
@ -54,7 +54,7 @@ public List<ExecutionPlanItem> createExecutionPlanItem( MavenProject mavenProjec
|
||||
List<ExecutionPlanItem> result = new ArrayList<ExecutionPlanItem>();
|
||||
for ( MojoExecution mojoExecution : executions )
|
||||
{
|
||||
String lifeCyclePhase = mojoExecution.getMojoDescriptor().getPhase();
|
||||
String lifeCyclePhase = mojoExecution.getLifecyclePhase();
|
||||
final Scheduling scheduling = getScheduling( "default" );
|
||||
Schedule schedule = null;
|
||||
if ( scheduling != null )
|
||||
|
@ -71,6 +71,12 @@ MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks
|
||||
PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
|
||||
PluginVersionResolutionException;
|
||||
|
||||
MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
|
||||
PluginVersionResolutionException;
|
||||
|
||||
void execute( MavenSession session );
|
||||
|
||||
// used by the site plugin 3.x
|
||||
|
@ -14,6 +14,16 @@
|
||||
*/
|
||||
package org.apache.maven.lifecycle.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.DefaultLifecycles;
|
||||
import org.apache.maven.lifecycle.DefaultSchedules;
|
||||
@ -45,18 +55,6 @@
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* @since 3.0
|
||||
* @author Benjamin Bentmann
|
||||
@ -104,7 +102,7 @@ public DefaultLifecycleExecutionPlanCalculator( BuildPluginManager pluginManager
|
||||
this.defaultSchedules = defaultSchedules;
|
||||
}
|
||||
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks )
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks, boolean setup )
|
||||
throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
|
||||
PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
|
||||
NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
@ -113,19 +111,39 @@ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenPro
|
||||
|
||||
final List<MojoExecution> executions = calculateMojoExecutions( session, project, tasks );
|
||||
|
||||
setupMojoExections( session, project, executions );
|
||||
if ( setup )
|
||||
{
|
||||
setupMojoExecutions( session, project, executions );
|
||||
}
|
||||
|
||||
final List<ExecutionPlanItem> planItem = defaultSchedules.createExecutionPlanItem( project, executions );
|
||||
|
||||
return new MavenExecutionPlan( planItem, defaultLifeCycles );
|
||||
}
|
||||
|
||||
private void setupMojoExections( MavenSession session, MavenProject project, List<MojoExecution> mojoExecutions )
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
|
||||
PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
|
||||
NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
{
|
||||
return calculateExecutionPlan( session, project, tasks, true );
|
||||
}
|
||||
|
||||
private void setupMojoExecutions( MavenSession session, MavenProject project, List<MojoExecution> mojoExecutions )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
|
||||
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
{
|
||||
for ( MojoExecution mojoExecution : mojoExecutions )
|
||||
{
|
||||
setupMojoExecution( session, project, mojoExecution );
|
||||
}
|
||||
}
|
||||
|
||||
public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
|
||||
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
{
|
||||
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
||||
|
||||
@ -146,9 +164,8 @@ private void setupMojoExections( MavenSession session, MavenProject project, Lis
|
||||
|
||||
calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() );
|
||||
}
|
||||
}
|
||||
|
||||
private List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject project,
|
||||
public List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject project,
|
||||
List<Object> tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
|
@ -48,11 +48,20 @@ MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject pr
|
||||
PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
|
||||
NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException;
|
||||
|
||||
MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks,
|
||||
boolean setup )
|
||||
throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
|
||||
PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
|
||||
NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException;
|
||||
|
||||
void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
|
||||
throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
|
||||
PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
|
||||
|
||||
|
||||
void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
|
||||
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
|
||||
|
||||
}
|
||||
|
@ -51,6 +51,11 @@ List<TaskSegment> calculateTaskSegments( MavenSession session )
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException;
|
||||
|
||||
public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginVersionResolutionException;
|
||||
|
||||
boolean requiresProject( MavenSession session );
|
||||
|
||||
}
|
||||
|
@ -111,7 +111,8 @@ public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession
|
||||
// Maybe do something ?
|
||||
}
|
||||
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks )
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks,
|
||||
boolean setup )
|
||||
throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
|
||||
PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
|
||||
NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
@ -131,6 +132,21 @@ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenPro
|
||||
return createExecutionPlan( project, me );
|
||||
}
|
||||
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
|
||||
PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
|
||||
NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
{
|
||||
return calculateExecutionPlan( session, project, tasks, true );
|
||||
}
|
||||
|
||||
public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
|
||||
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
{
|
||||
}
|
||||
|
||||
public static MavenExecutionPlan getProjectAExceutionPlan()
|
||||
throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
|
||||
PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
|
||||
|
@ -46,6 +46,11 @@ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String..
|
||||
return new MavenExecutionPlan( null, null );
|
||||
}
|
||||
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
|
||||
{
|
||||
return new MavenExecutionPlan( null, null );
|
||||
}
|
||||
|
||||
public void execute( MavenSession session )
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user