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 e84813b939..6cca52fbd9 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
@@ -83,6 +83,7 @@ public class IntegrationTestSuite
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.class );
suite.addTestSuite( MavenITmng4842ParentResolutionOfDependencyPomTest.class );
suite.addTestSuite( MavenITmng4834ParentProjectResolvedFromRemoteReposTest.class );
suite.addTestSuite( MavenITmng4829ChecksumFailureWarningTest.class );
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.java
new file mode 100644
index 0000000000..0eb921152e
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.java
@@ -0,0 +1,65 @@
+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-4872.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4872ReactorResolutionAttachedWithExclusionsTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng4872ReactorResolutionAttachedWithExclusionsTest()
+ {
+ super( "[3.0-beta-1,)" );
+ }
+
+ /**
+ * Test that resolution of (attached) artifacts from the reactor doesn't cause exclusions to be lost.
+ */
+ public void testit()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4872" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "consumer/target" );
+ verifier.deleteArtifacts( "org.apache.maven.its.mng4872" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ List artifacts = verifier.loadLines( "consumer/target/artifacts.txt", "UTF-8" );
+
+ assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4872:producer:jar:0.1" ) );
+ assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4872:producer:jar:shaded:0.1" ) );
+ assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4872:excluded:jar:0.1" ) );
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/mng-4872/consumer/pom.xml b/its/core-it-suite/src/test/resources/mng-4872/consumer/pom.xml
new file mode 100644
index 0000000000..da5c5acc1f
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4872/consumer/pom.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng4872
+ consumer
+ 0.1
+ jar
+
+ Maven Integration Test :: MNG-4872 :: Dependency Consumer
+
+ Test that resolution of (attached) artifacts from the reactor doesn't cause exclusions to be lost.
+
+
+
+
+
+ org.apache.maven.its.mng4872
+ producer
+ 0.1
+
+
+ org.apache.maven.its.mng4872
+ excluded
+
+
+
+
+
+ org.apache.maven.its.mng4872
+ producer
+ 0.1
+ shaded
+
+
+ org.apache.maven.its.mng4872
+ excluded
+
+
+
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-dependency-resolution
+ 2.1-SNAPSHOT
+
+ target/artifacts.txt
+ 1
+
+
+
+ resolve
+ validate
+
+ compile
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4872/pom.xml b/its/core-it-suite/src/test/resources/mng-4872/pom.xml
new file mode 100644
index 0000000000..09fed84950
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4872/pom.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng4872
+ aggregator
+ 0.1-SNAPSHOT
+ pom
+
+ Maven Integration Test :: MNG-4872
+
+ Test that resolution of (attached) artifacts from the reactor doesn't cause exclusions to be lost.
+
+
+
+ producer
+ consumer
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4872/producer/pom.xml b/its/core-it-suite/src/test/resources/mng-4872/producer/pom.xml
new file mode 100644
index 0000000000..c80fb662bf
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4872/producer/pom.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng4872
+ producer
+ 0.1
+ jar
+
+ Maven Integration Test :: MNG-4872 :: Dependency Producer
+
+ Test that resolution of (attached) artifacts from the reactor doesn't cause exclusions to be lost.
+
+
+
+
+
+ org.apache.maven.its.mng4872
+ excluded
+ 0.1
+
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-artifact
+ 2.1-SNAPSHOT
+
+
+ package
+ validate
+
+ set
+ attach
+
+
+ pom.xml
+ pom.xml
+ jar
+ shaded
+
+
+
+
+
+
+