mirror of https://github.com/apache/maven.git
o Fixed parsing of default phase bindings
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@806005 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2e0b074c5e
commit
43e0979b5e
|
@ -559,16 +559,6 @@ public class DefaultLifecycleExecutor
|
|||
{
|
||||
List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>();
|
||||
|
||||
// TODO: remove hard coding
|
||||
if ( phase.equals( "clean" ) )
|
||||
{
|
||||
Plugin plugin = new Plugin();
|
||||
plugin.setGroupId( "org.apache.maven.plugins" );
|
||||
plugin.setArtifactId( "maven-clean-plugin" );
|
||||
plugin.setVersion( "2.3" );
|
||||
mojoExecutions.add( new MojoExecution( plugin, "clean", "default-clean" ) );
|
||||
}
|
||||
|
||||
lifecycleMappings.put( phase, mojoExecutions );
|
||||
|
||||
if ( phase.equals( lifecyclePhase ) )
|
||||
|
@ -1067,15 +1057,24 @@ public class DefaultLifecycleExecutor
|
|||
org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration =
|
||||
lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );
|
||||
|
||||
Map<String, String> phaseToGoalMapping = null;
|
||||
|
||||
if ( lifecycleConfiguration != null )
|
||||
{
|
||||
Map<String, String> lifecyclePhasesForPackaging = lifecycleConfiguration.getPhases();
|
||||
|
||||
phaseToGoalMapping = lifecycleConfiguration.getPhases();
|
||||
}
|
||||
else if ( lifecycle.getDefaultPhases() != null )
|
||||
{
|
||||
phaseToGoalMapping = lifecycle.getDefaultPhases();
|
||||
}
|
||||
|
||||
if ( phaseToGoalMapping != null )
|
||||
{
|
||||
// These are of the form:
|
||||
//
|
||||
// compile -> org.apache.maven.plugins:maven-compiler-plugin:compile[,gid:aid:goal,...]
|
||||
//
|
||||
for ( Map.Entry<String, String> goalsForLifecyclePhase : lifecyclePhasesForPackaging.entrySet() )
|
||||
for ( Map.Entry<String, String> goalsForLifecyclePhase : phaseToGoalMapping.entrySet() )
|
||||
{
|
||||
String phase = goalsForLifecyclePhase.getKey();
|
||||
String goals = goalsForLifecyclePhase.getValue();
|
||||
|
@ -1085,13 +1084,6 @@ public class DefaultLifecycleExecutor
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ( lifecycle.getDefaultPhases() != null )
|
||||
{
|
||||
for ( String goals : lifecycle.getDefaultPhases() )
|
||||
{
|
||||
parseLifecyclePhaseDefinitions( plugins, null, goals );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return plugins.keySet();
|
||||
|
|
|
@ -20,17 +20,31 @@ package org.apache.maven.lifecycle;
|
|||
*/
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Class Lifecycle.
|
||||
*/
|
||||
public class Lifecycle
|
||||
{
|
||||
|
||||
// <lifecycle>
|
||||
// <id>clean</id>
|
||||
// <phases>
|
||||
// <phase>pre-clean</phase>
|
||||
// <phase>clean</phase>
|
||||
// <phase>post-clean</phase>
|
||||
// </phases>
|
||||
// <default-phases>
|
||||
// <clean>org.apache.maven.plugins:maven-clean-plugin:clean</clean>
|
||||
// </default-phases>
|
||||
// </lifecycle>
|
||||
|
||||
private String id;
|
||||
|
||||
private List<String> phases;
|
||||
|
||||
private List<String> defaultPhases;
|
||||
private Map<String, String> defaultPhases;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
|
@ -42,7 +56,7 @@ public class Lifecycle
|
|||
return this.phases;
|
||||
}
|
||||
|
||||
public List<String> getDefaultPhases()
|
||||
public Map<String, String> getDefaultPhases()
|
||||
{
|
||||
return defaultPhases;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue