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 0fd852a436..d2e291086a 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
@@ -80,6 +80,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenITmng3714ToolchainsCliOptionTest.class );
// suite.addTestSuite( MavenITmng3645POMSyntaxErrorTest.class );
// suite.addTestSuite( MavenITmng3391ImportScopeErrorScenariosTest.class );
+ // suite.addTestSuite( MavenITmng3043BestEffortReactorResolutionTest.class );
// suite.addTestSuite( MavenITmng3038TransitiveDepManVersionTest.class );
// suite.addTestSuite( MavenITmng2994SnapshotRangeRepositoryTest.class );
// suite.addTestSuite( MavenITmng2771PomExtensionComponentOverrideTest.class );
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java
new file mode 100644
index 0000000000..992b2dd738
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3043BestEffortReactorResolutionTest.java
@@ -0,0 +1,176 @@
+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.List;
+
+/**
+ * This is a test set for MNG-3043.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng3043BestEffortReactorResolutionTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng3043BestEffortReactorResolutionTest()
+ {
+ super( "[2.1.0,)" );
+ }
+
+ /**
+ * Test that dependencies on attached artifacts like a test JAR or an EJB client JAR which have not been built
+ * yet, i.e. in build phases prior to "package" like "test", are satisfied from the output directories of the
+ * projects in the reactor. This is meant as a best effort to provide a class path for compilation or testing.
+ */
+ public void testitTestPhase()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3043" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "consumer-a/target" );
+ verifier.deleteDirectory( "consumer-b/target" );
+ verifier.deleteDirectory( "consumer-c/target" );
+ verifier.deleteArtifacts( "org.apache.maven.its.mng3043" );
+ verifier.setLogFileName( "log-test.txt" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ List classpath;
+
+ classpath = verifier.loadLines( "consumer-a/target/compile.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-test" } );
+ assertNotContains( classpath, new String[] { "classes-main" } );
+ classpath = verifier.loadLines( "consumer-a/target/runtime.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-test" } );
+ assertNotContains( classpath, new String[] { "classes-main" } );
+ classpath = verifier.loadLines( "consumer-a/target/test.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-test" } );
+ assertNotContains( classpath, new String[] { "classes-main" } );
+
+ classpath = verifier.loadLines( "consumer-b/target/compile.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-main" } );
+ assertNotContains( classpath, new String[] { "classes-test" } );
+ classpath = verifier.loadLines( "consumer-b/target/runtime.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-main" } );
+ assertNotContains( classpath, new String[] { "classes-test" } );
+ classpath = verifier.loadLines( "consumer-b/target/test.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-main" } );
+ assertNotContains( classpath, new String[] { "classes-test" } );
+
+ classpath = verifier.loadLines( "consumer-c/target/compile.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-main" } );
+ assertContains( classpath, new String[] { "classes-test" } );
+ classpath = verifier.loadLines( "consumer-c/target/runtime.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-main" } );
+ assertContains( classpath, new String[] { "classes-test" } );
+ classpath = verifier.loadLines( "consumer-c/target/test.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "classes-main" } );
+ assertContains( classpath, new String[] { "classes-test" } );
+ }
+
+ /**
+ * Test that dependency resolution still uses to the actual artifact files once these have been
+ * assembled/attached in the "package" phase. This ensures the class path is accurate and not locked to
+ * the output directories of the best effort model from above.
+ */
+ public void testitPackagePhase()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3043" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "consumer-a/target" );
+ verifier.deleteDirectory( "consumer-b/target" );
+ verifier.deleteDirectory( "consumer-c/target" );
+ verifier.deleteArtifacts( "org.apache.maven.its.mng3043" );
+ verifier.setLogFileName( "log-package.txt" );
+ verifier.executeGoal( "initialize" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ List classpath;
+
+ classpath = verifier.loadLines( "consumer-a/target/compile.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "tests.jar" } );
+ assertNotContains( classpath, new String[] { "client.jar" } );
+ classpath = verifier.loadLines( "consumer-a/target/runtime.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "tests.jar" } );
+ assertNotContains( classpath, new String[] { "client.jar" } );
+ classpath = verifier.loadLines( "consumer-a/target/test.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "tests.jar" } );
+ assertNotContains( classpath, new String[] { "client.jar" } );
+
+ classpath = verifier.loadLines( "consumer-b/target/compile.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "client.jar" } );
+ assertNotContains( classpath, new String[] { "tests.jar" } );
+ classpath = verifier.loadLines( "consumer-b/target/runtime.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "client.jar" } );
+ assertNotContains( classpath, new String[] { "tests.jar" } );
+ classpath = verifier.loadLines( "consumer-b/target/test.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "client.jar" } );
+ assertNotContains( classpath, new String[] { "tests.jar" } );
+
+ classpath = verifier.loadLines( "consumer-c/target/compile.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "client.jar" } );
+ assertContains( classpath, new String[] { "tests.jar" } );
+ classpath = verifier.loadLines( "consumer-c/target/runtime.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "client.jar" } );
+ assertContains( classpath, new String[] { "tests.jar" } );
+ classpath = verifier.loadLines( "consumer-c/target/test.txt", "UTF-8" );
+ assertContains( classpath, new String[] { "client.jar" } );
+ assertContains( classpath, new String[] { "tests.jar" } );
+ }
+
+ private void assertContains( List collection, Object[] items )
+ {
+ for ( int i = 0; i < items.length; i++ )
+ {
+ assertContains( collection, items[i] );
+ }
+ }
+
+ private void assertContains( List collection, Object item )
+ {
+ assertTrue( item + " missing in " + collection, collection.contains( item ) );
+ }
+
+ private void assertNotContains( List collection, Object[] items )
+ {
+ for ( int i = 0; i < items.length; i++ )
+ {
+ assertNotContains( collection, items[i] );
+ }
+ }
+
+ private void assertNotContains( List collection, Object item )
+ {
+ assertFalse( item + " present in " + collection, collection.contains( item ) );
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/mng-3043/consumer-a/pom.xml b/its/core-it-suite/src/test/resources/mng-3043/consumer-a/pom.xml
new file mode 100644
index 0000000000..10fbd0b5ad
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3043/consumer-a/pom.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mng3043
+ parent
+ 1
+
+
+ consumer-a
+
+ Maven Integration Test :: MNG-3043 :: Consumer A
+
+ Test that dependencies on attached artifacts like a test JAR or an EJB client JAR which have not been built
+ yet, i.e. in build phases prior to "package" like "test", are satisfied from the output directories of the
+ projects in the reactor. This is meant as a best effort to provide a class path for compilation or testing.
+
+
+
+
+
+ org.apache.maven.its.mng3043
+ dependency
+ 0.1-SNAPSHOT
+ test-jar
+
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-dependency-resolution
+ 2.1-SNAPSHOT
+
+
+ compile-classpath
+ validate
+
+ compile
+ runtime
+ test
+
+
+ target/compile.txt
+ target/runtime.txt
+ target/test.txt
+ 1
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-3043/consumer-b/pom.xml b/its/core-it-suite/src/test/resources/mng-3043/consumer-b/pom.xml
new file mode 100644
index 0000000000..0e3e0e6dfa
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3043/consumer-b/pom.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mng3043
+ parent
+ 1
+
+
+ consumer-b
+
+ Maven Integration Test :: MNG-3043 :: Consumer B
+
+ Test that dependencies on attached artifacts like a test JAR or an EJB client JAR which have not been built
+ yet, i.e. in build phases prior to "package" like "test", are satisfied from the output directories of the
+ projects in the reactor. This is meant as a best effort to provide a class path for compilation or testing.
+
+
+
+
+
+ org.apache.maven.its.mng3043
+ dependency
+ 0.1-SNAPSHOT
+ ejb-client
+
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-dependency-resolution
+ 2.1-SNAPSHOT
+
+
+ compile-classpath
+ validate
+
+ compile
+ runtime
+ test
+
+
+ target/compile.txt
+ target/runtime.txt
+ target/test.txt
+ 1
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-3043/consumer-c/pom.xml b/its/core-it-suite/src/test/resources/mng-3043/consumer-c/pom.xml
new file mode 100644
index 0000000000..06ff590818
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3043/consumer-c/pom.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mng3043
+ parent
+ 1
+
+
+ consumer-c
+
+ Maven Integration Test :: MNG-3043 :: Consumer C
+
+ Test that dependencies on attached artifacts like a test JAR or an EJB client JAR which have not been built
+ yet, i.e. in build phases prior to "package" like "test", are satisfied from the output directories of the
+ projects in the reactor. This is meant as a best effort to provide a class path for compilation or testing.
+
+
+
+
+
+ org.apache.maven.its.mng3043
+ dependency
+ 0.1-SNAPSHOT
+ test-jar
+
+
+ org.apache.maven.its.mng3043
+ dependency
+ 0.1-SNAPSHOT
+ ejb-client
+
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-dependency-resolution
+ 2.1-SNAPSHOT
+
+
+ compile-classpath
+ validate
+
+ compile
+ runtime
+ test
+
+
+ target/compile.txt
+ target/runtime.txt
+ target/test.txt
+ 1
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-3043/dependency/classes-main/client.jar b/its/core-it-suite/src/test/resources/mng-3043/dependency/classes-main/client.jar
new file mode 100644
index 0000000000..d1fb4ec7c0
Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-3043/dependency/classes-main/client.jar differ
diff --git a/its/core-it-suite/src/test/resources/mng-3043/dependency/classes-test/tests.jar b/its/core-it-suite/src/test/resources/mng-3043/dependency/classes-test/tests.jar
new file mode 100644
index 0000000000..d1fb4ec7c0
Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-3043/dependency/classes-test/tests.jar differ
diff --git a/its/core-it-suite/src/test/resources/mng-3043/dependency/pom.xml b/its/core-it-suite/src/test/resources/mng-3043/dependency/pom.xml
new file mode 100644
index 0000000000..120b740716
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3043/dependency/pom.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mng3043
+ parent
+ 1
+
+
+ dependency
+ 0.1-SNAPSHOT
+
+ Maven Integration Test :: MNG-3043 :: Dependency
+
+ Test that dependencies on attached artifacts like a test JAR or an EJB client JAR which have not been built
+ yet, i.e. in build phases prior to "package" like "test", are satisfied from the output directories of the
+ projects in the reactor. This is meant as a best effort to provide a class path for compilation or testing.
+
+
+
+ classes-main
+ classes-test
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-artifact
+ 2.1-SNAPSHOT
+
+
+
+
+ package-test-jar
+ initialize
+
+ attach
+
+
+ test-classes/tests.jar
+ test-jar
+ tests
+
+
+
+
+ package-ejb-client-jar
+ initialize
+
+ attach
+
+
+ main-classes/client.jar
+ ejb-client
+ client
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-3043/pom.xml b/its/core-it-suite/src/test/resources/mng-3043/pom.xml
new file mode 100644
index 0000000000..74b936f81a
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3043/pom.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng3043
+ parent
+ 1
+ pom
+
+ Maven Integration Test :: MNG-3043
+
+ Test that dependencies on attached artifacts like a test JAR or an EJB client JAR which have not been built
+ yet, i.e. in build phases prior to "package" like "test", are satisfied from the output directories of the
+ projects in the reactor. This is meant as a best effort to provide a class path for compilation or testing.
+
+
+
+ dependency
+ consumer-a
+ consumer-b
+ consumer-c
+
+