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 2011/01/05 16:15:04 UTC

svn commit: r1055485 - in /maven/core-integration-testing/trunk: core-it-suite/src/test/java/org/apache/maven/it/ core-it-suite/src/test/resources/mng-4919/ core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/

Author: bentmann
Date: Wed Jan  5 15:15:04 2011
New Revision: 1055485

URL: http://svn.apache.org/viewvc?rev=1055485&view=rev
Log:
[MNG-4919] Plugin execution contributed by lifecycle mapping gets lost when same goal is bound multiple times

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4919/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4919/pom.xml   (with props)
Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=1055485&r1=1055484&r2=1055485&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Wed Jan  5 15:15:04 2011
@@ -87,6 +87,7 @@ public class IntegrationTestSuite
         suite.addTestSuite( MavenITmng4952MetadataReleaseInfoUpdateTest.class );
         suite.addTestSuite( MavenITmng4936EventSpyTest.class );
         suite.addTestSuite( MavenITmng4925ContainerLookupRealmDuringMojoExecTest.class );
+        suite.addTestSuite( MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.class );
         suite.addTestSuite( MavenITmng4913UserPropertyVsDependencyPomPropertyTest.class );
         suite.addTestSuite( MavenITmng4895PluginDepWithNonRelocatedMavenApiTest.class );
         suite.addTestSuite( MavenITmng4891RobustSnapshotResolutionTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java?rev=1055485&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java Wed Jan  5 15:15:04 2011
@@ -0,0 +1,62 @@
+package org.apache.maven.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4919">MNG-4919</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4919LifecycleMappingWithSameGoalTwiceTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng4919LifecycleMappingWithSameGoalTwiceTest()
+    {
+        super( "[2.0.3,3.0-alpha-1),[3.0.2,)" );
+    }
+
+    /**
+     * Verify that lifecycle mappings can bind a goal twice, say in different phases.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4919" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoals( Arrays.asList( new String[] { "clean", "validate" } ) );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        List lines = verifier.loadLines( "target/log.txt", "UTF-8" );
+        assertEquals( Arrays.asList( new String[] { "check", "check" } ), lines );
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4919LifecycleMappingWithSameGoalTwiceTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4919/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4919/pom.xml?rev=1055485&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4919/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4919/pom.xml Wed Jan  5 15:15:04 2011
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng4919</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>same-goal-twice</packaging>
+
+  <name>Maven Integration Test :: MNG-4919</name> 
+  <description>
+    Verify that lifecycle mappings can bind a goal twice, say in different phases.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-packaging</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <extensions>true</extensions>
+        <configuration>
+          <outputFile>target/log.txt</outputFile>
+          <message>check</message>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4919/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4919/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml?rev=1055485&r1=1055484&r2=1055485&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-packaging/src/main/resources/META-INF/plexus/components.xml Wed Jan  5 15:15:04 2011
@@ -49,6 +49,27 @@
       </configuration>
     </component>
     <component>
+      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role-hint>same-goal-twice</role-hint>
+      <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      <configuration>
+        <lifecycles>
+          <lifecycle>
+            <id>default</id>
+            <phases>
+              <validate>org.apache.maven.its.plugins:maven-it-plugin-packaging:append</validate>
+            </phases>
+          </lifecycle>
+          <lifecycle>
+            <id>clean</id>
+            <phases>
+              <clean>org.apache.maven.its.plugins:maven-it-plugin-packaging:append</clean>
+            </phases>
+          </lifecycle>
+        </lifecycles>
+      </configuration>
+    </component>
+    <component>
       <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
       <role-hint>it-artifact</role-hint>
       <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>