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 2b30a4521e..15ccb876d9 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
@@ -248,6 +248,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng0985NonExecutedPluginMngtGoalsTest.class );
suite.addTestSuite( MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest.class );
suite.addTestSuite( MavenITmng0932TestJarDeploymentTest.class );
+ suite.addTestSuite( MavenITmng0870ReactorAwarePluginDiscoveryTest.class );
suite.addTestSuite( MavenITmng0866EvaluateDefaultValueTest.class );
suite.addTestSuite( MavenITmng0851CustomPomFilenameTest.class );
suite.addTestSuite( MavenITmng0848SystemPropOverridesDefaultValueTest.class );
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0249ResolveDepsFromReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0249ResolveDepsFromReactorTest.java
index 97c6a7a6a7..8f7bc17c6f 100644
--- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0249ResolveDepsFromReactorTest.java
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0249ResolveDepsFromReactorTest.java
@@ -25,8 +25,7 @@ import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
/**
- * This is a test set for MNG-249 and
- * MNG-870.
+ * This is a test set for MNG-249.
*
* @author Brett Porter
* @version $Id$
@@ -51,7 +50,6 @@ public class MavenITmng0249ResolveDepsFromReactorTest
"test-component-c/target/test-component-c-0.1.war!/WEB-INF/lib/test-component-a-0.1.jar" );
verifier.assertFilePresent(
"test-component-c/target/test-component-c-0.1.war!/WEB-INF/lib/test-component-b-0.1.jar" );
- verifier.assertFilePresent( "test-component-c/target/my-test" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0870ReactorAwarePluginDiscoveryTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0870ReactorAwarePluginDiscoveryTest.java
new file mode 100644
index 0000000000..d63118660f
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0870ReactorAwarePluginDiscoveryTest.java
@@ -0,0 +1,63 @@
+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 java.io.File;
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * This is a test set for MNG-870.
+ *
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng0870ReactorAwarePluginDiscoveryTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng0870ReactorAwarePluginDiscoveryTest()
+ {
+ super();
+ }
+
+ /**
+ * Test that the reactor can resolve plugins that have just been built by a previous module and are not yet
+ * installed to the local repo.
+ */
+ public void testitMNG0870()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0870" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "project/target" );
+ verifier.deleteArtifacts( "org.apache.maven.its.mng0870" );
+ verifier.filterFile( "pom.xml", "pom.xml", "UTF-8", verifier.newDefaultFilterProperties() );
+ verifier.executeGoal( "initialize" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ verifier.assertFilePresent( "project/target/touch.txt" );
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/mng-0249/pom.xml b/its/core-it-suite/src/test/resources/mng-0249/pom.xml
index 4a1db263fe..9f5be434a8 100644
--- a/its/core-it-suite/src/test/resources/mng-0249/pom.xml
+++ b/its/core-it-suite/src/test/resources/mng-0249/pom.xml
@@ -10,6 +10,5 @@
test-component-c
test-component-b
test-component-a
- test-plugin
diff --git a/its/core-it-suite/src/test/resources/mng-0249/test-component-c/pom.xml b/its/core-it-suite/src/test/resources/mng-0249/test-component-c/pom.xml
index a80af53bdc..58fa1e129d 100644
--- a/its/core-it-suite/src/test/resources/mng-0249/test-component-c/pom.xml
+++ b/its/core-it-suite/src/test/resources/mng-0249/test-component-c/pom.xml
@@ -17,24 +17,4 @@
0.1
-
-
-
-
- org.apache.maven.its.it0042
- test-plugin
- 0.1
-
- my-test
-
-
-
-
- test
-
-
-
-
-
-
diff --git a/its/core-it-suite/src/test/resources/mng-0249/test-plugin/pom.xml b/its/core-it-suite/src/test/resources/mng-0249/test-plugin/pom.xml
deleted file mode 100644
index 76ac302991..0000000000
--- a/its/core-it-suite/src/test/resources/mng-0249/test-plugin/pom.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
- 4.0.0
-
- maven-it-it0042
- org.apache.maven.its.it0042
- 0.1
-
- test-plugin
- maven-plugin
- 0.1
- Test Plugin
-
-
- org.apache.maven
- maven-plugin-api
- 2.0-beta-1
-
-
-
diff --git a/its/core-it-suite/src/test/resources/mng-0249/test-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java b/its/core-it-suite/src/test/resources/mng-0249/test-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
deleted file mode 100644
index 978ba54ddd..0000000000
--- a/its/core-it-suite/src/test/resources/mng-0249/test-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.apache.maven.plugin.coreit.it0042;
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-/**
- * @goal test
- *
- * @phase process-sources
- *
- * @description Goal which cleans the build
- */
-public class CoreItMojo
- extends AbstractMojo
-{
- /**
- * @parameter expression="${project.build.directory}"
- * @required
- */
- private String outputDirectory;
-
- /**
- * @parameter
- * @required
- */
- private String value;
-
- public void execute()
- throws MojoExecutionException
- {
- touch( new File( outputDirectory ), value );
- }
-
- private static void touch( File dir, String file )
- throws MojoExecutionException
- {
- try
- {
- if ( !dir.exists() )
- {
- dir.mkdirs();
- }
-
- File touch = new File( dir, file );
-
- FileWriter w = new FileWriter( touch );
-
- w.write( file );
-
- w.close();
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error touching file", e );
- }
- }
-}
diff --git a/its/core-it-suite/src/test/resources/mng-0870/plugin/it-maven-plugin-0.1-SNAPSHOT.jar b/its/core-it-suite/src/test/resources/mng-0870/plugin/it-maven-plugin-0.1-SNAPSHOT.jar
new file mode 100644
index 0000000000..c80dad4df0
Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-0870/plugin/it-maven-plugin-0.1-SNAPSHOT.jar differ
diff --git a/its/core-it-suite/src/test/resources/mng-0870/plugin/pom.xml b/its/core-it-suite/src/test/resources/mng-0870/plugin/pom.xml
new file mode 100644
index 0000000000..d379de64c9
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-0870/plugin/pom.xml
@@ -0,0 +1,97 @@
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mng0870
+ test
+ 1-SNAPSHOT
+
+
+ org.apache.maven.its.mng0870
+ it-maven-plugin
+ 0.1-SNAPSHOT
+ maven-plugin
+
+ Maven Integration Test :: MNG-870 :: Test Plugin
+
+ Test that the reactor can resolve plugins that have just been built by a previous module and are not yet
+ installed to the local repo.
+
+
+
+ true
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.0
+
+
+
+ org.apache.maven.its.mng0870
+ dep
+ 0.1
+
+
+
+
+
+
+ .
+
+ pom.xml
+ src/**
+
+
+
+ src/main/resources
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-artifact
+ 2.1-SNAPSHOT
+
+ it-maven-plugin-0.1-SNAPSHOT.jar
+
+
+
+ test
+ initialize
+
+ set
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-0870/plugin/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java b/its/core-it-suite/src/test/resources/mng-0870/plugin/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java
new file mode 100644
index 0000000000..52cde76d3e
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-0870/plugin/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java
@@ -0,0 +1,86 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * Creates a touch file if and only if a resource from the plugin dependency was successfully loaded, fails otherwise.
+ *
+ * @goal load
+ * @phase validate
+ *
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class LoadMojo
+ extends AbstractMojo
+{
+
+ /**
+ * The path to the output file, relative to the project base directory.
+ *
+ * @parameter expression="${touch.file}" default-value="target/touch.txt"
+ */
+ private File file;
+
+ /**
+ * Runs this mojo.
+ *
+ * @throws MojoExecutionException If the output file could not be created.
+ * @throws MojoFailureException If the output file has not been set.
+ */
+ public void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ String resource = "mng0870.properties";
+
+ getLog().info( "[MAVEN-CORE-IT-LOG] Loading resource from plugin dependency: " + resource );
+
+ URL url = getClass().getResource( "/" + resource );
+
+ getLog().info( "[MAVEN-CORE-IT-LOG] " + url );
+
+ if ( url == null )
+ {
+ throw new MojoExecutionException( "Resource was not found, incomplete plugin class realm" );
+ }
+
+ getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + file );
+
+ try
+ {
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Output file could not be created: " + file, e );
+ }
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/mng-0870/pom.xml b/its/core-it-suite/src/test/resources/mng-0870/pom.xml
new file mode 100644
index 0000000000..fada881136
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-0870/pom.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng0870
+ test
+ 1-SNAPSHOT
+ pom
+
+ Maven Integration Test :: MNG-870
+
+ Test that the reactor can resolve plugins that have just been built by a previous module and are not yet
+ installed to the local repo.
+
+
+
+ plugin
+ project
+
+
+
+
+ maven-core-it
+ @baseurl@/repo
+
+ ignore
+
+
+ false
+
+
+
+
+
+ maven-core-it
+ @baseurl@/repo
+
+ ignore
+
+
+ false
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-0870/project/pom.xml b/its/core-it-suite/src/test/resources/mng-0870/project/pom.xml
new file mode 100644
index 0000000000..fad34b7d5c
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-0870/project/pom.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mng0870
+ test
+ 1-SNAPSHOT
+
+
+ org.apache.maven.its.mng0870
+ project
+ 0.2-SNAPSHOT
+ jar
+
+ Maven Integration Test :: MNG-870 :: Plugin Consumer
+
+ Test that the reactor can resolve plugins that have just been built by a previous module and are not yet
+ installed to the local repo.
+
+
+
+
+
+
+ org.apache.maven.its.mng0870
+ it-maven-plugin
+ 0.1-SNAPSHOT
+
+ target/touch.txt
+
+
+
+ test
+ initialize
+
+ load
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/0.1/dep-0.1.jar b/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/0.1/dep-0.1.jar
new file mode 100644
index 0000000000..26183eecdf
Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/0.1/dep-0.1.jar differ
diff --git a/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/0.1/dep-0.1.pom b/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/0.1/dep-0.1.pom
new file mode 100644
index 0000000000..4cb0949bd5
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/0.1/dep-0.1.pom
@@ -0,0 +1,36 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng0870
+ dep
+ 0.1
+ jar
+
+
+
+ maven-core-it
+ file:///${basedir}/repo
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/maven-metadata.xml
new file mode 100644
index 0000000000..df8e94c119
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-0870/repo/org/apache/maven/its/mng0870/dep/maven-metadata.xml
@@ -0,0 +1,12 @@
+
+ org.apache.maven.its.mng0870
+ dep
+ 0.1
+
+ 0.1
+
+ 0.1
+
+ 20090116193749
+
+
\ No newline at end of file