You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2009/01/26 04:29:07 UTC

svn commit: r737633 - in /maven/components/trunk: maven-project-builder/src/main/java/org/apache/maven/project/builder/ maven-project/src/test/java/org/apache/maven/project/builder/ maven-project/src/test/resources-project-builder/plugin-exec-merging/w...

Author: sisbell
Date: Mon Jan 26 03:29:07 2009
New Revision: 737633

URL: http://svn.apache.org/viewvc?rev=737633&view=rev
Log:
MNG-3887: order of plugin executions, MNG-3864: plugin configs are collapsed, MNG-4000: Plugin executions without id are lost

Modified:
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java
    maven/components/trunk/maven-project/src/test/resources-project-builder/plugin-exec-merging/wo-plugin-mngt/sub/pom.xml

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java?rev=737633&r1=737632&r2=737633&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java (original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java Mon Jan 26 03:29:07 2009
@@ -333,19 +333,20 @@
                 continue;
             }
 
-            boolean hasAtLeastOneWithoutId = true;
+            boolean hasAtLeastOneWithoutId = false;
             
             for ( ModelContainer executionContainer : executionContainers )
             {
-                if ( hasAtLeastOneWithoutId )
-                {
-                    hasAtLeastOneWithoutId = hasExecutionId( executionContainer );
-                }
+
                 
-                if ( !hasAtLeastOneWithoutId && !hasExecutionId( executionContainer ) && executionContainers.indexOf( executionContainer ) > 0 )
+                if ( hasAtLeastOneWithoutId && !hasExecutionId( executionContainer ) && executionContainers.indexOf( executionContainer ) > 0 )
                 {
                     removeProperties.addAll( executionContainer.getProperties() );
                 }
+                if ( !hasAtLeastOneWithoutId )
+                {
+                    hasAtLeastOneWithoutId = !hasExecutionId( executionContainer );
+                }                
             }
         }
         
@@ -362,16 +363,17 @@
                                     new AlwaysJoinModelContainerFactory()));
             for(ModelContainer es : executionSource.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri )) {
                 ExecutionRule rule = new ExecutionRule();
-                //List<ModelProperty> x = rule.execute(es.getProperties());
-                List<ModelProperty> x = (!joinedContainer) ? rule.execute(es.getProperties()) :
-                        ModelTransformerContext.sort(rule.execute(es.getProperties()),
-                                ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri);
+                List<ModelProperty> x = rule.execute(es.getProperties());
+               // List<ModelProperty> x = (!joinedContainer) ? rule.execute(es.getProperties()) :
+               //         ModelTransformerContext.sort(rule.execute(es.getProperties()),
+               //                 ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri);
                 
                 dataSource.replace(es, es.createNewInstance(x));
             }
         }
 
-        props = dataSource.getModelProperties();
+        props = joinedContainer ? ModelTransformerContext.sort(dataSource.getModelProperties(), ProjectUri.baseUri)
+                : dataSource.getModelProperties();
        
         for(ModelEventListener listener : eventListeners)
         {

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java?rev=737633&r1=737632&r2=737633&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java (original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java Mon Jan 26 03:29:07 2009
@@ -111,7 +111,9 @@
         throws Exception
     {
         PomTestWrapper pom = buildPom( "execution-configuration" );
-        assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions[1]/configuration" ) ).size() );
+        assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
+        assertEquals( "src/main/mdo/nexus.xml", ( pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/model" ) ));
+        assertEquals( "src/main/mdo/security.xml", ( pom.getValue( "build/plugins[1]/executions[2]/configuration[1]/model" ) ));
     }
 
     public void testSingleConfigurationInheritance()
@@ -128,8 +130,8 @@
     {
         PomTestWrapper pom = buildPom( "config-with-plugin-mng" );
         assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
-        assertEquals( "src/main/mdo/security.xml", pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/model" ) );
-        assertEquals( "1.0.8", pom.getValue( "build/plugins[1]/executions[2]/configuration[1]/version" ) );
+        assertEquals( "src/main/mdo/security.xml", pom.getValue( "build/plugins[1]/executions[2]/configuration[1]/model" ) );
+        assertEquals( "1.0.8", pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/version" ) );
     }
 
     /** MNG-3965 */
@@ -145,7 +147,7 @@
         throws Exception
     {
         PomTestWrapper pom = buildPom( "foo/sub" );
-        System.out.println(pom.getDomainModel().asString());
+        //System.out.println(pom.getDomainModel().asString());
     }
 
     /** MNG-3985 */
@@ -211,7 +213,7 @@
         assertEquals( "e", pom.getValue( "build/plugins[1]/executions[5]/id" ) );
     }
 
-    /* FIXME: cf. MNG-3887
+    /* FIXME: cf. MNG-3887 */
     public void testOrderOfPluginExecutionsWithPluginManagement()
         throws Exception
     {
@@ -248,7 +250,7 @@
         assertEquals( "<?xml version='1.0'?>Tom&Jerry", pom.getValue( "properties/xmlTest" ) );
     }
 
-    /* FIXME: cf. MNG-3925 
+    /* FIXME: cf. MNG-3925
     public void testOrderOfMergedPluginExecutionsWithoutPluginManagement()
         throws Exception
     {
@@ -315,7 +317,7 @@
     {
         PomTestWrapper pom = buildPom( "plugin-exec-merging/wo-plugin-mngt/sub" );
         assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
-        assertEquals( "child-default", pom.getValue( "build/plugins[1]/executions[@id='default']/phase" ) );
+        assertEquals( "child-default", pom.getValue( "build/plugins[1]/executions[@id='default-execution-id']/phase" ) );
         assertEquals( "child-non-default", pom.getValue( "build/plugins[1]/executions[@id='non-default']/phase" ) );
     }
 
@@ -514,7 +516,7 @@
         assertEquals( "four", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[4]" ) );
     }
 
-    /* FIXME: cf. MNG-3827
+    /* FIXME: cf. MNG-3827*/
     public void testOrderOfPluginConfigurationElementsWithPluginManagement()
         throws Exception
     {
@@ -539,7 +541,7 @@
         assertEquals( "key2", pom.getValue( prefix + "propertiesParam/property[2]/name" ) );
     }
 
-    /* FIXME: cf. MNG-3864
+    /* FIXME: cf. MNG-3864*/
     public void testOrderOfPluginExecutionConfigurationElementsWithPluginManagement()
         throws Exception
     {
@@ -598,7 +600,7 @@
     }
     //*/
 
-    /* FIXME: cf. MNG-4000
+    /* FIXME: cf. MNG-4000 */
     public void testMultiplePluginExecutionsWithAndWithoutIdsWithoutPluginManagement()
         throws Exception
     {

Modified: maven/components/trunk/maven-project/src/test/resources-project-builder/plugin-exec-merging/wo-plugin-mngt/sub/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/plugin-exec-merging/wo-plugin-mngt/sub/pom.xml?rev=737633&r1=737632&r2=737633&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/resources-project-builder/plugin-exec-merging/wo-plugin-mngt/sub/pom.xml (original)
+++ maven/components/trunk/maven-project/src/test/resources-project-builder/plugin-exec-merging/wo-plugin-mngt/sub/pom.xml Mon Jan 26 03:29:07 2009
@@ -45,7 +45,7 @@
         <executions>
           <execution>
             <!-- NOTE: Explicitly reference "default" id here -->
-            <id>default</id>
+            <id>default-execution-id</id>
             <phase>child-default</phase>
           </execution>
           <execution>