diff --git a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
index fe443e8c6c..6d24b81442 100644
--- a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
+++ b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
@@ -184,6 +184,7 @@ public class IntegrationTestSuite
// 2.0.7 only (TODO: detect what version is used before running them)
suite.addTestSuite( MavenIT0115CustomArtifactHandlerAndCustomLifecycleTest.class );
suite.addTestSuite( MavenIT0119PluginPrefixOrder.class );
+ suite.addTestSuite( MavenITmng3372DirectInvocationOfPlugins.class );
// suite.addTestSuite( MavenIT0120EjbClientDependency.class ); -- not passing for 2.0.7 either, looks to be 2.1+ ?
return suite;
}
diff --git a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3372DirectInvocationOfPlugins.java b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3372DirectInvocationOfPlugins.java
new file mode 100644
index 0000000000..90fa2c07b9
--- /dev/null
+++ b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3372DirectInvocationOfPlugins.java
@@ -0,0 +1,82 @@
+package org.apache.maven.integrationtests;
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * This is a sample integration test. The IT tests typically
+ * operate by having a sample project in the
+ * /src/test/resources folder along with a junit test like
+ * this one. The junit test uses the verifier (which uses
+ * the invoker) to invoke a new instance of Maven on the
+ * project in the resources folder. It then checks the
+ * results. This is a non-trivial example that shows two
+ * phases. See more information inline in the code.
+ *
+ * @author Brian Fox
+ *
+ */
+public class MavenITmng3372DirectInvocationOfPlugins
+ extends TestCase
+{
+
+ public void testDirectMojoInvocationWithPrefix()
+ throws Exception
+ {
+ // The testdir is computed from the location of this
+ // file.
+ File testBaseDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3372-directInvocationOfPlugins/direct-using-prefix" );
+ File plugin = new File( testBaseDir, "plugin" );
+ File project = new File( testBaseDir, "project" );
+ File settingsFile = new File( testBaseDir, "settings.xml" );
+
+ Verifier verifier = new Verifier( plugin.getAbsolutePath() );
+
+ verifier.deleteArtifact( "org.apache.maven.its.mng3372", "mng3372-maven-plugin", "1", "jar" );
+
+ verifier.executeGoals( Arrays.asList( new String[]{ "clean", "install" } ) );
+
+ verifier = new Verifier( project.getAbsolutePath() );
+
+ List cliOptions = new ArrayList();
+ cliOptions.add( "-s" );
+ cliOptions.add( settingsFile.getAbsolutePath() );
+
+ verifier.setCliOptions( cliOptions );
+ verifier.executeGoal( "mng3372:test" );
+
+ verifier.verifyErrorFreeLog();
+
+ verifier.resetStreams();
+ }
+
+ public void testDependencyTreeInvocation()
+ throws Exception
+ {
+ // The testdir is computed from the location of this
+ // file.
+ File testBaseDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3372-directInvocationOfPlugins/dependency-tree" );
+ File settingsFile = new File( testBaseDir, "settings.xml" );
+
+ Verifier verifier = new Verifier( testBaseDir.getAbsolutePath() );
+
+ List cliOptions = new ArrayList();
+ cliOptions.add( "-s" );
+ cliOptions.add( settingsFile.getAbsolutePath() );
+ cliOptions.add( "-U" );
+
+ verifier.setCliOptions( cliOptions );
+ verifier.executeGoal( "dependency:tree" );
+
+ verifier.verifyErrorFreeLog();
+
+ verifier.resetStreams();
+ }
+}
diff --git a/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/dependency-tree/pom.xml b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/dependency-tree/pom.xml
new file mode 100644
index 0000000000..d65d88ccf6
--- /dev/null
+++ b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/dependency-tree/pom.xml
@@ -0,0 +1,1031 @@
+
+
+
+ 4.0.0
+ org.apache.maven.its.mng3372
+ dependency-tree
+ 1
+
+
+
+ org.apache.maven
+ maven-core
+ 2.0.8
+
+
+
+
+
diff --git a/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/dependency-tree/settings.xml b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/dependency-tree/settings.xml
new file mode 100644
index 0000000000..6ab3600b27
--- /dev/null
+++ b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/dependency-tree/settings.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ asf-snapshots
+
+
+ asf-snapshots
+ http://people.apache.org/repo/m2-snapshot-repository/
+
+
+
+
+
+ asf-snapshots
+
+
diff --git a/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/plugin/pom.xml b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/plugin/pom.xml
new file mode 100644
index 0000000000..b14cd70fa6
--- /dev/null
+++ b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/plugin/pom.xml
@@ -0,0 +1,16 @@
+
+ 4.0.0
+ org.apache.maven.its.mng3372
+ mng3372-maven-plugin
+ maven-plugin
+ 1
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.0
+
+
+
diff --git a/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/plugin/src/main/java/org/plugin/TestMojo.java b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/plugin/src/main/java/org/plugin/TestMojo.java
new file mode 100644
index 0000000000..796f1bb911
--- /dev/null
+++ b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/plugin/src/main/java/org/plugin/TestMojo.java
@@ -0,0 +1,68 @@
+package org.plugin;
+
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * @goal test
+ */
+public class TestMojo
+ implements Mojo
+{
+
+ private Log log;
+
+ /**
+ * @parameter default-value="${project.build.directory}"
+ * @required
+ * @readonly
+ */
+ private File buildDir;
+
+ public void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ File outFile = new File( buildDir, "out.txt" );
+ FileWriter writer = null;
+ try
+ {
+ outFile.getParentFile().mkdirs();
+
+ writer = new FileWriter( outFile );
+ writer.write( "Test" );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Failed to write: " + outFile.getAbsolutePath(), e );
+ }
+ finally
+ {
+ if ( writer != null )
+ {
+ try
+ {
+ writer.close();
+ }
+ catch ( IOException e )
+ {
+ }
+ }
+ }
+ }
+
+ public Log getLog()
+ {
+ return log;
+ }
+
+ public void setLog( Log log )
+ {
+ this.log = log;
+ }
+}
diff --git a/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/pom.xml b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/pom.xml
new file mode 100644
index 0000000000..4be3391cd8
--- /dev/null
+++ b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/pom.xml
@@ -0,0 +1,18 @@
+
+ 4.0.0
+ org.apache.maven.its.mng3372
+ project
+ jar
+ 1.0-SNAPSHOT
+ project
+ http://maven.apache.org
+
+
+ junit
+ junit
+ 3.8.1
+ test
+
+
+
diff --git a/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/src/main/java/org/test/App.java b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/src/main/java/org/test/App.java
new file mode 100644
index 0000000000..0b3975ddcf
--- /dev/null
+++ b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/src/main/java/org/test/App.java
@@ -0,0 +1,13 @@
+package org.test;
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
diff --git a/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/src/test/java/org/test/AppTest.java b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/src/test/java/org/test/AppTest.java
new file mode 100644
index 0000000000..b84ebc68eb
--- /dev/null
+++ b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/project/src/test/java/org/test/AppTest.java
@@ -0,0 +1,38 @@
+package org.test;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
diff --git a/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/settings.xml b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/settings.xml
new file mode 100644
index 0000000000..a37547626f
--- /dev/null
+++ b/its/core-integration-tests/src/test/resources/mng-3372-directInvocationOfPlugins/direct-using-prefix/settings.xml
@@ -0,0 +1,5 @@
+
+
+ org.apache.maven.its.mng3372
+
+
\ No newline at end of file