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/10 00:30:13 UTC

svn commit: r813144 - in /maven/maven-3/trunk/maven-core/src: main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java

Author: bentmann
Date: Wed Sep  9 22:30:13 2009
New Revision: 813144

URL: http://svn.apache.org/viewvc?rev=813144&view=rev
Log:
[MNG-4350] [regression] Multiple goals bound to the same phase in a lifecycle mapping get executed out of order

Modified:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java

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=813144&r1=813143&r2=813144&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 Wed Sep  9 22:30:13 2009
@@ -1609,16 +1609,18 @@
 
     private void parseLifecyclePhaseDefinitions( Map<Plugin, Plugin> plugins, String phase, String goals )
     {
-        for ( StringTokenizer tok = new StringTokenizer( goals, "," ); tok.hasMoreTokens(); )
+        String[] mojos = StringUtils.split( goals, "," );
+
+        for ( int i = 0; i < mojos.length; i++ )
         {
             // either <groupId>:<artifactId>:<goal> or <groupId>:<artifactId>:<version>:<goal>
-            String goal = tok.nextToken().trim();
+            String goal = mojos[i].trim();
             String[] p = StringUtils.split( goal, ":" );
 
             PluginExecution execution = new PluginExecution();
             execution.setId( "default-" + p[p.length - 1] );
             execution.setPhase( phase );
-            execution.setPriority( -1 );
+            execution.setPriority( i - mojos.length );
             execution.getGoals().add( p[p.length - 1] );
 
             Plugin plugin = new Plugin();

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java?rev=813144&r1=813143&r2=813144&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java Wed Sep  9 22:30:13 2009
@@ -146,8 +146,8 @@
         //[11] resources:testResources
         //[12] compiler:testCompile
         //[13] surefire:test
-        //[14] plugin:addPluginArtifactMetadata        
-        //[15] jar:jar
+        //[14] jar:jar
+        //[15] plugin:addPluginArtifactMetadata        
         //[16] install:install
         //
         
@@ -166,8 +166,8 @@
         assertEquals( "resources:testResources", executions.get( 10 ).getMojoDescriptor().getFullGoalName() );
         assertEquals( "compiler:testCompile", executions.get( 11 ).getMojoDescriptor().getFullGoalName() );
         assertEquals( "surefire:test", executions.get( 12 ).getMojoDescriptor().getFullGoalName() );
-        assertEquals( "plugin:addPluginArtifactMetadata", executions.get( 13 ).getMojoDescriptor().getFullGoalName() );                
-        assertEquals( "jar:jar", executions.get( 14 ).getMojoDescriptor().getFullGoalName() );                
+        assertEquals( "jar:jar", executions.get( 13 ).getMojoDescriptor().getFullGoalName() );                
+        assertEquals( "plugin:addPluginArtifactMetadata", executions.get( 14 ).getMojoDescriptor().getFullGoalName() );                
         assertEquals( "install:install", executions.get( 15 ).getMojoDescriptor().getFullGoalName() );
         
         assertEquals( "src/main/mdo/remote-resources.mdo", new MojoExecutionXPathContainer( executions.get( 1 ) ).getValue( "configuration/models[1]/model" ) );