diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 6dffa90799..5c2caf11d4 100644
--- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -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 );
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBasedMojoSupportTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java
similarity index 90%
rename from its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBasedMojoSupportTest.java
rename to its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java
index 5f102f2f46..eba1c6b909 100644
--- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBasedMojoSupportTest.java
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4396AntBased20xMojoSupportTest.java
@@ -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
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java
new file mode 100644
index 0000000000..f2fb6985a2
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4786AntBased21xMojoSupportTest.java
@@ -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 MNG-4786.
+ *
+ * @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" );
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml b/its/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml
index e15e634e74..b858e66933 100644
--- a/its/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml
+++ b/its/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml
@@ -51,5 +51,21 @@ under the License.
1.4
runtime
+
+ org.apache.maven
+ maven-script-ant
+ 2.1.0
+ runtime
+
+
+ org.apache.maven
+ maven-project
+
+
+ org.apache.maven
+ maven-core
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4786/pom.xml b/its/core-it-suite/src/test/resources/mng-4786/pom.xml
new file mode 100644
index 0000000000..6a45677e1c
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4786/pom.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng4786
+ test
+ 0.1
+
+ Maven Integration Test :: MNG-4786
+
+ 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.
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-ant-based
+ 2.1-SNAPSHOT
+
+ target/ant.txt
+
+
+
+ test
+ validate
+
+ touch
+
+
+
+
+
+ org.apache.maven
+ maven-script-ant
+ 2.1.0
+
+
+ org.apache.maven
+ maven-project
+
+
+ org.apache.maven
+ maven-core
+
+
+ org.codehaus.plexus
+ plexus-component-api
+
+
+
+
+
+
+
+