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 8f45f4c311..0fd852a436 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
@@ -91,6 +91,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng4072InactiveProfileReposTest.class );
suite.addTestSuite( MavenITmng4070WhitespaceTrimmingTest.class );
suite.addTestSuite( MavenITmng4068AuthenticatedMirrorTest.class );
suite.addTestSuite( MavenITmng4056ClassifierBasedDepResolutionFromReactorTest.class );
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4072InactiveProfileReposTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4072InactiveProfileReposTest.java
new file mode 100644
index 0000000000..b49dcb162e
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4072InactiveProfileReposTest.java
@@ -0,0 +1,75 @@
+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.Properties;
+
+/**
+ * This is a test set for MNG-4072.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4072InactiveProfileReposTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng4072InactiveProfileReposTest()
+ {
+ super( ALL_MAVEN_VERSIONS );
+ }
+
+ /**
+ * Test that repositories from inactive profiles are actually not used for artifact resolution.
+ */
+ public void testit()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4072" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteArtifacts( "org.apache.maven.its.mng4072" );
+ Properties filterProps = verifier.newDefaultFilterProperties();
+ verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", filterProps );
+ verifier.filterFile( "profiles-template.xml", "profiles.xml", "UTF-8", filterProps );
+ verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
+ verifier.getCliOptions().add( "--settings" );
+ verifier.getCliOptions().add( "settings.xml" );
+ try
+ {
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ fail( "Dependency resolution succeeded although all profiles are inactive" );
+ }
+ catch ( Exception e )
+ {
+ // expected, all profiles are inactive, hence the repos inaccessible
+ }
+ finally
+ {
+ verifier.resetStreams();
+ }
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/mng-4072/pom-template.xml b/its/core-it-suite/src/test/resources/mng-4072/pom-template.xml
new file mode 100644
index 0000000000..3e1011f0bc
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4072/pom-template.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng4072
+ test
+ 1.0
+ jar
+
+ Maven Integration Test :: MNG-4072
+
+ Test that repositories from inactive profiles are actually not used for artifact resolution.
+
+
+
+
+ org.apache.maven.its.mng4072
+ a
+ 0.1
+
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-dependency-resolution
+ 2.1-SNAPSHOT
+
+
+ test
+ validate
+
+ compile
+
+
+
+
+
+
+
+
+
+
+ maven-core-it-repo-pom
+
+
+ maven-core-it
+ @baseurl@/repo
+
+ ignore
+
+
+ false
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4072/profiles-template.xml b/its/core-it-suite/src/test/resources/mng-4072/profiles-template.xml
new file mode 100644
index 0000000000..89d39ba23f
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4072/profiles-template.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+ maven-core-it-repo-profiles
+
+
+ maven-core-it
+ @baseurl@/repo
+
+ ignore
+
+
+ false
+
+
+
+
+
+ false
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/0.1/a-0.1.jar b/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/0.1/a-0.1.jar
new file mode 100644
index 0000000000..d40d839c3e
Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/0.1/a-0.1.jar differ
diff --git a/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/0.1/a-0.1.pom b/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/0.1/a-0.1.pom
new file mode 100644
index 0000000000..ad69cf3b34
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/0.1/a-0.1.pom
@@ -0,0 +1,36 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng4072
+ a
+ 0.1
+ jar
+
+
+
+ maven-core-it
+ file:///${basedir}/repo
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/maven-metadata.xml
new file mode 100644
index 0000000000..ba6b3ad03f
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4072/repo/org/apache/maven/its/mng4072/a/maven-metadata.xml
@@ -0,0 +1,13 @@
+
+
+ org.apache.maven.its.mng4072
+ a
+ 0.1
+
+ 0.1
+
+ 0.1
+
+ 20090306235034
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4072/settings-template.xml b/its/core-it-suite/src/test/resources/mng-4072/settings-template.xml
new file mode 100644
index 0000000000..cc6b5c447d
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4072/settings-template.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+ maven-core-it-repo-settings
+
+
+ maven-core-it
+ @baseurl@/repo
+
+ ignore
+
+
+ false
+
+
+
+
+
+
+
+
+ central
+ @baseurl@/null
+ central
+
+
+