You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/09/08 13:27:57 UTC
svn commit: r812467 - in /maven/maven-3/trunk:
maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven-model/src/main/mdo/maven.mdo
Author: bentmann
Date: Tue Sep 8 11:27:57 2009
New Revision: 812467
URL: http://svn.apache.org/viewvc?rev=812467&view=rev
Log:
[MNG-4345] [regression] Plugin executions contributed by default lifecycle mapping execute after other plugin executions bound to the same phase
Modified:
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=812467&r1=812466&r2=812467&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Tue Sep 8 11:27:57 2009
@@ -29,6 +29,7 @@
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.TreeMap;
import java.util.TreeSet;
import org.apache.maven.ProjectDependenciesResolver;
@@ -944,13 +945,14 @@
* is interested in, i.e. all phases up to and including the specified phase.
*/
- Map<String, List<MojoExecution>> lifecycleMappings = new LinkedHashMap<String, List<MojoExecution>>();
+ Map<String, Map<Integer, List<MojoExecution>>> mappings =
+ new LinkedHashMap<String, Map<Integer, List<MojoExecution>>>();
for ( String phase : lifecycle.getPhases() )
{
- List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>();
+ Map<Integer, List<MojoExecution>> phaseBindings = new TreeMap<Integer, List<MojoExecution>>();
- lifecycleMappings.put( phase, mojoExecutions );
+ mappings.put( phase, phaseBindings );
if ( phase.equals( lifecyclePhase ) )
{
@@ -973,13 +975,13 @@
// to examine the phase it is associated to.
if ( execution.getPhase() != null )
{
- List<MojoExecution> mojoExecutions = lifecycleMappings.get( execution.getPhase() );
- if ( mojoExecutions != null )
+ Map<Integer, List<MojoExecution>> phaseBindings = mappings.get( execution.getPhase() );
+ if ( phaseBindings != null )
{
for ( String goal : execution.getGoals() )
{
MojoExecution mojoExecution = new MojoExecution( plugin, goal, execution.getId() );
- mojoExecutions.add( mojoExecution );
+ addMojoExecution( phaseBindings, mojoExecution, execution.getPriority() );
}
}
}
@@ -991,20 +993,48 @@
MojoDescriptor mojoDescriptor =
pluginManager.getMojoDescriptor( plugin, goal, getRepositoryRequest( session, project ) );
- List<MojoExecution> mojoExecutions = lifecycleMappings.get( mojoDescriptor.getPhase() );
- if ( mojoExecutions != null )
+ Map<Integer, List<MojoExecution>> phaseBindings = mappings.get( mojoDescriptor.getPhase() );
+ if ( phaseBindings != null )
{
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, execution.getId() );
- mojoExecutions.add( mojoExecution );
+ addMojoExecution( phaseBindings, mojoExecution, execution.getPriority() );
}
}
}
}
}
+ Map<String, List<MojoExecution>> lifecycleMappings = new LinkedHashMap<String, List<MojoExecution>>();
+
+ for ( Map.Entry<String, Map<Integer, List<MojoExecution>>> entry : mappings.entrySet() )
+ {
+ List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>();
+
+ for ( List<MojoExecution> executions : entry.getValue().values() )
+ {
+ mojoExecutions.addAll( executions );
+ }
+
+ lifecycleMappings.put( entry.getKey(), mojoExecutions );
+ }
+
return lifecycleMappings;
}
+ private void addMojoExecution( Map<Integer, List<MojoExecution>> phaseBindings, MojoExecution mojoExecution,
+ int priority )
+ {
+ List<MojoExecution> mojoExecutions = phaseBindings.get( priority );
+
+ if ( mojoExecutions == null )
+ {
+ mojoExecutions = new ArrayList<MojoExecution>();
+ phaseBindings.put( priority, mojoExecutions );
+ }
+
+ mojoExecutions.add( mojoExecution );
+ }
+
public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
@@ -1591,6 +1621,7 @@
PluginExecution execution = new PluginExecution();
execution.setId( "default-" + p[p.length - 1] );
execution.setPhase( phase );
+ execution.setPriority( -1 );
execution.getGoals().add( p[p.length - 1] );
Plugin plugin = new Plugin();
Modified: maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo?rev=812467&r1=812466&r2=812467&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo (original)
+++ maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo Tue Sep 8 11:27:57 2009
@@ -2902,6 +2902,19 @@
<description>The build lifecycle phase to bind the goals in this execution to. If omitted,
the goals will be bound to the default phase specified in their metadata. </description>
</field>
+ <field xml.transient="true">
+ <name>priority</name>
+ <version>4.0.0</version>
+ <type>int</type>
+ <description>
+ <![CDATA[
+ The priority of this execution compared to other executions which are bound to the same phase.
+ <strong>Warning:</strong> This is an internal utility property that is only public for technical reasons,
+ it is not part of the public API. In particular, this property can be changed or deleted without prior
+ notice.
+ ]]>
+ </description>
+ </field>
<field>
<name>goals</name>
<version>4.0.0</version>