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 2010/08/31 18:53:49 UTC

svn commit: r991258 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/bootstrap/group-6/ resources/mng-4786/

Author: bentmann
Date: Tue Aug 31 16:53:49 2010
New Revision: 991258

URL: http://svn.apache.org/viewvc?rev=991258&view=rev
Log:
[MNG-4786] [regression] Ant-based mojo using maven-script-ant:2.1.0+ causes NPE

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java
      - copied, changed from r989196, maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBasedMojoSupportTest.java
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4786/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4786/pom.xml   (with props)
Removed:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBasedMojoSupportTest.java
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-suite/src/test/resources/bootstrap/group-6/pom.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=991258&r1=991257&r2=991258&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 Tue Aug 31 16:53:49 2010
@@ -81,6 +81,7 @@ public class IntegrationTestSuite
         // -------------------------------------------------------------------------------------------------------------
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
 
+        suite.addTestSuite( MavenITmng4786AntBased21xMojoSupportTest.class );
         suite.addTestSuite( MavenITmng4781DeploymentToNexusStagingRepoTest.class );
         suite.addTestSuite( MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.class );
         suite.addTestSuite( MavenITmng4776ForkedReactorPluginVersionResolutionTest.class );
@@ -158,7 +159,7 @@ public class IntegrationTestSuite
         suite.addTestSuite( MavenITmng4402DuplicateChildModuleTest.class );
         suite.addTestSuite( MavenITmng4401RepositoryOrderForParentPomTest.class );
         suite.addTestSuite( MavenITmng4400RepositoryOrderTest.class );
-        suite.addTestSuite( MavenITmng4396AntBasedMojoSupportTest.class );
+        suite.addTestSuite( MavenITmng4396AntBased20xMojoSupportTest.class );
         suite.addTestSuite( MavenITmng4393ParseExternalParenPomLenientTest.class );
         suite.addTestSuite( MavenITmng4387QuietLoggingTest.class );
         suite.addTestSuite( MavenITmng4386DebugLoggingTest.class );

Copied: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java (from r989196, maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBasedMojoSupportTest.java)
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java?p2=maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java&p1=maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBasedMojoSupportTest.java&r1=989196&r2=991258&rev=991258&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBasedMojoSupportTest.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java Tue Aug 31 16:53:49 2010
@@ -29,17 +29,18 @@ import java.io.File;
  * 
  * @author Benjamin Bentmann
  */
-public class MavenITmng4396AntBasedMojoSupportTest
+public class MavenITmng4396AntBased20xMojoSupportTest
     extends AbstractMavenIntegrationTestCase
 {
 
-    public MavenITmng4396AntBasedMojoSupportTest()
+    public MavenITmng4396AntBased20xMojoSupportTest()
     {
         super( ALL_MAVEN_VERSIONS );
     }
 
     /**
-     * Verify that plugins whose mojos are implemented as Ant scripts can be invoked.
+     * Verify that plugins whose mojos are implemented as Ant scripts and use the Maven 2.0.x Ant support can be
+     * invoked.
      */
     public void testit()
         throws Exception

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java?rev=991258&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java Tue Aug 31 16:53:49 2010
@@ -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;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4786">MNG-4786</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4786AntBased21xMojoSupportTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng4786AntBased21xMojoSupportTest()
+    {
+        super( "[2.0.3,3.0-alpha-1),[3.0-beta-4,)" );
+    }
+
+    /**
+     * Verify that plugins whose mojos are implemented as Ant scripts and use the Maven 2.1.x Ant support can be
+     * invoked. The essential bits here are that Ant-based mojos are instantiated via a custom component factory, yet
+     * must undergo the same IoC as for regular Java components. And the 2.1.x Ant support actually requires injection
+     * of a logger.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4786" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        verifier.assertFilePresent( "target/ant.txt" );
+    }
+
+}

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

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

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml?rev=991258&r1=991257&r2=991258&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml Tue Aug 31 16:53:49 2010
@@ -51,5 +51,21 @@ under the License.
       <version>1.4</version>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-script-ant</artifactId>
+      <version>2.1.0</version>
+      <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-project</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-core</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
   </dependencies>
 </project>

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4786/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4786/pom.xml?rev=991258&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4786/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4786/pom.xml Tue Aug 31 16:53:49 2010
@@ -0,0 +1,79 @@
+<?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.mng4786</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+
+  <name>Maven Integration Test :: MNG-4786</name>
+  <description>
+    Verify that plugins whose mojos are implemented as Ant scripts and use the Maven 2.1.x Ant support can be
+    invoked. The essential bits here are that Ant-based mojos are instantiated via a custom component factory, yet
+    must undergo the same IoC as for regular Java components. And the 2.1.x Ant support actually requires injection
+    of a logger.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-ant-based</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <outputFile>target/ant.txt</outputFile>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>touch</goal>
+            </goals>
+          </execution>
+        </executions>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-script-ant</artifactId>
+            <version>2.1.0</version>
+            <exclusions>
+              <exclusion>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-project</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-core</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.codehaus.plexus</groupId>
+                <artifactId>plexus-component-api</artifactId>
+              </exclusion>
+            </exclusions>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

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