mirror of https://github.com/apache/maven.git
o Formatted code
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@933172 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e171aa5e0d
commit
3d2bebeb19
|
@ -19,7 +19,12 @@ package org.apache.maven.lifecycle;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.maven.lifecycle.internal.ExecutionPlanItem;
|
import org.apache.maven.lifecycle.internal.ExecutionPlanItem;
|
||||||
import org.apache.maven.plugin.MojoExecution;
|
import org.apache.maven.plugin.MojoExecution;
|
||||||
|
@ -31,7 +36,8 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
//TODO: project dependencies that need downloading
|
//TODO: project dependencies that need downloading
|
||||||
//TODO: unfortunately the plugins need to be downloaded in order to get the plugin.xml file. need to externalize this from the plugin archive.
|
//TODO: unfortunately the plugins need to be downloaded in order to get the plugin.xml file. need to externalize this from the plugin archive.
|
||||||
//TODO: this will be the class that people get in IDEs to modify
|
//TODO: this will be the class that people get in IDEs to modify
|
||||||
public class MavenExecutionPlan implements Iterable<ExecutionPlanItem>
|
public class MavenExecutionPlan
|
||||||
|
implements Iterable<ExecutionPlanItem>
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -53,30 +59,35 @@ public class MavenExecutionPlan implements Iterable<ExecutionPlanItem>
|
||||||
private final Map<String, ExecutionPlanItem> lastInPhase;
|
private final Map<String, ExecutionPlanItem> lastInPhase;
|
||||||
private final List<String> phasesInOrder;
|
private final List<String> phasesInOrder;
|
||||||
|
|
||||||
public MavenExecutionPlan(Set<String> requiredDependencyResolutionScopes, Set<String> requiredDependencyCollectionScopes, List<ExecutionPlanItem> planItem) {
|
public MavenExecutionPlan( Set<String> requiredDependencyResolutionScopes,
|
||||||
|
Set<String> requiredDependencyCollectionScopes, List<ExecutionPlanItem> planItem )
|
||||||
|
{
|
||||||
this.requiredDependencyResolutionScopes = requiredDependencyResolutionScopes;
|
this.requiredDependencyResolutionScopes = requiredDependencyResolutionScopes;
|
||||||
this.requiredDependencyCollectionScopes = requiredDependencyCollectionScopes;
|
this.requiredDependencyCollectionScopes = requiredDependencyCollectionScopes;
|
||||||
this.planItem = planItem;
|
this.planItem = planItem;
|
||||||
lastInPhase = new HashMap<String, ExecutionPlanItem>();
|
lastInPhase = new HashMap<String, ExecutionPlanItem>();
|
||||||
phasesInOrder = new ArrayList<String>();
|
phasesInOrder = new ArrayList<String>();
|
||||||
for (ExecutionPlanItem executionPlanItem : getExecutionPlanItems()) {
|
for ( ExecutionPlanItem executionPlanItem : getExecutionPlanItems() )
|
||||||
|
{
|
||||||
final String phaseName = getPhase( executionPlanItem );
|
final String phaseName = getPhase( executionPlanItem );
|
||||||
if (!lastInPhase.containsKey( phaseName )){
|
if ( !lastInPhase.containsKey( phaseName ) )
|
||||||
|
{
|
||||||
phasesInOrder.add( phaseName );
|
phasesInOrder.add( phaseName );
|
||||||
}
|
}
|
||||||
lastInPhase.put( phaseName, executionPlanItem );
|
lastInPhase.put( phaseName, executionPlanItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPhase( ExecutionPlanItem executionPlanItem){
|
private String getPhase( ExecutionPlanItem executionPlanItem )
|
||||||
|
{
|
||||||
final MojoExecution mojoExecution = executionPlanItem.getMojoExecution();
|
final MojoExecution mojoExecution = executionPlanItem.getMojoExecution();
|
||||||
final MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
final MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
||||||
return mojoDescriptor.getPhase();
|
return mojoDescriptor.getPhase();
|
||||||
|
|
||||||
}
|
}
|
||||||
public Iterator<ExecutionPlanItem> iterator() {
|
|
||||||
|
public Iterator<ExecutionPlanItem> iterator()
|
||||||
|
{
|
||||||
return getExecutionPlanItems().iterator();
|
return getExecutionPlanItems().iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +97,8 @@ public class MavenExecutionPlan implements Iterable<ExecutionPlanItem>
|
||||||
* @param executionPlanItem The execution plan item
|
* @param executionPlanItem The execution plan item
|
||||||
* @return The ExecutionPlanItem or null if none can be found
|
* @return The ExecutionPlanItem or null if none can be found
|
||||||
*/
|
*/
|
||||||
public ExecutionPlanItem findLastInPhase( ExecutionPlanItem executionPlanItem){
|
public ExecutionPlanItem findLastInPhase( ExecutionPlanItem executionPlanItem )
|
||||||
|
{
|
||||||
ExecutionPlanItem executionPlanItem1 = lastInPhase.get( getPhase( executionPlanItem ) );
|
ExecutionPlanItem executionPlanItem1 = lastInPhase.get( getPhase( executionPlanItem ) );
|
||||||
return executionPlanItem1;
|
return executionPlanItem1;
|
||||||
}
|
}
|
||||||
|
@ -96,13 +108,14 @@ public class MavenExecutionPlan implements Iterable<ExecutionPlanItem>
|
||||||
return planItem;
|
return planItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceAllComplete(){
|
public void forceAllComplete()
|
||||||
for (ExecutionPlanItem executionPlanItem : getExecutionPlanItems()) {
|
{
|
||||||
|
for ( ExecutionPlanItem executionPlanItem : getExecutionPlanItems() )
|
||||||
|
{
|
||||||
executionPlanItem.forceComplete();
|
executionPlanItem.forceComplete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Set<String> getRequiredResolutionScopes()
|
public Set<String> getRequiredResolutionScopes()
|
||||||
{
|
{
|
||||||
return requiredDependencyResolutionScopes;
|
return requiredDependencyResolutionScopes;
|
||||||
|
@ -113,17 +126,19 @@ public class MavenExecutionPlan implements Iterable<ExecutionPlanItem>
|
||||||
return requiredDependencyCollectionScopes;
|
return requiredDependencyCollectionScopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<MojoExecution> getMojoExecutions()
|
||||||
public List<MojoExecution> getMojoExecutions(){
|
{
|
||||||
List<MojoExecution> result = new ArrayList<MojoExecution>();
|
List<MojoExecution> result = new ArrayList<MojoExecution>();
|
||||||
for ( ExecutionPlanItem executionPlanItem : planItem )
|
for ( ExecutionPlanItem executionPlanItem : planItem )
|
||||||
{
|
{
|
||||||
result.add( executionPlanItem.getMojoExecution());
|
result.add( executionPlanItem.getMojoExecution() );
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int size() {
|
public int size()
|
||||||
|
{
|
||||||
return planItem.size();
|
return planItem.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue