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 54364e5c0a..005790b9ca 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
@@ -95,7 +95,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng3940EnvVarInterpolationTest.class );
suite.addTestSuite( MavenITmng3938MergePluginExecutionsTest.class );
suite.addTestSuite( MavenITmng3937MergedPluginExecutionGoalsTest.class );
- suite.addTestSuite( MavenITmng3933OsTriggeredExternalProfileTest.class );
+ suite.addTestSuite( MavenITmng3933ProfilesXmlActivationTest.class );
suite.addTestSuite( MavenITmng3927PluginDefaultExecutionConfigTest.class );
suite.addTestSuite( MavenITmng3925MergedPluginExecutionOrderTest.class );
suite.addTestSuite( MavenITmng3924XmlMarkupInterpolationTest.class );
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933OsTriggeredExternalProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933OsTriggeredExternalProfileTest.java
deleted file mode 100644
index 5386a09659..0000000000
--- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933OsTriggeredExternalProfileTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-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 org.apache.maven.it.util.Os;
-
-import java.io.File;
-import java.util.Properties;
-
-/**
- * This is a test set for MNG-3933.
- *
- * @author Benjamin Bentmann
- * @version $Id$
- */
-public class MavenITmng3933OsTriggeredExternalProfileTest
- extends AbstractMavenIntegrationTestCase
-{
-
- public MavenITmng3933OsTriggeredExternalProfileTest()
- {
- super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" );
- }
-
- /**
- * Test that OS-triggered profiles from an external profiles.xml are activated.
- */
- public void testitMNG3933()
- throws Exception
- {
- File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3933" );
-
- Verifier verifier = new Verifier( testDir.getAbsolutePath() );
- verifier.setAutoclean( false );
- verifier.deleteDirectory( "target" );
- verifier.executeGoal( "validate" );
- verifier.verifyErrorFreeLog();
- verifier.resetStreams();
-
- Properties props = verifier.loadProperties( "target/profile.properties" );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) || Os.isFamily( Os.FAMILY_MAC ) || Os.isFamily( Os.FAMILY_UNIX ) )
- {
- assertEquals( "PASSED", props.getProperty( "project.properties.profileProperty" ) );
- }
- else
- {
- System.out.println();
- System.out.println( "[WARNING] Skipping test on unrecognized OS: " + Os.OS_NAME );
- System.out.println();
- }
- }
-
-}
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933ProfilesXmlActivationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933ProfilesXmlActivationTest.java
new file mode 100644
index 0000000000..7ba7b432f8
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933ProfilesXmlActivationTest.java
@@ -0,0 +1,97 @@
+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 org.apache.maven.it.util.Os;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Properties;
+
+/**
+ * This is a test set for MNG-3933.
+ *
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng3933ProfilesXmlActivationTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng3933ProfilesXmlActivationTest()
+ {
+ }
+
+ /**
+ * Test that profiles from an external profiles.xml are properly activated. This is really a different story
+ * than profiles in the settings.xml or the POM.
+ */
+ public void testitMNG3933()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3933" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.getSystemProperties().setProperty( "maven.profile.activator", "test" );
+ verifier.executeGoal( "validate", Collections.singletonMap( "MAVEN_PROFILE", "test" ) );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Properties props = verifier.loadProperties( "target/profile.properties" );
+
+ assertEquals( "DEFAULT-ACTIVATION", props.getProperty( "project.properties.defaultProperty" ) );
+
+ assertEquals( "SYS-PROP-ACTIVATION", props.getProperty( "project.properties.sysProperty" ) );
+
+ if ( matchesVersionRange( "(2.0.8,)" ) )
+ {
+ // MNG-2848
+ assertEquals( "ENV-PROP-ACTIVATION", props.getProperty( "project.properties.envProperty" ) );
+ }
+
+ assertEquals( "MISSING-FILE-ACTIVATION", props.getProperty( "project.properties.fileProperty" ) );
+
+ assertEquals( "JDK-ACTIVATION", props.getProperty( "project.properties.jdkProperty" ) );
+
+ if ( matchesVersionRange( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ) )
+ {
+ // MNG-3933
+ if ( Os.isFamily( Os.FAMILY_WINDOWS ) || Os.isFamily( Os.FAMILY_MAC ) || Os.isFamily( Os.FAMILY_UNIX ) )
+ {
+ assertEquals( "OS-FAMILY-ACTIVATION", props.getProperty( "project.properties.osFamilyProperty" ) );
+ }
+ else
+ {
+ System.out.println();
+ System.out.println( "[WARNING] Skipping OS activation test on unrecognized OS: " + Os.OS_NAME );
+ System.out.println();
+ }
+ }
+
+ assertEquals( null, props.getProperty( "project.properties.sysPropertyMissing" ) );
+ assertEquals( null, props.getProperty( "project.properties.envPropertyMissing" ) );
+ assertEquals( null, props.getProperty( "project.properties.filePropertyMissing" ) );
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/mng-3933/profiles.xml b/its/core-it-suite/src/test/resources/mng-3933/profiles.xml
index 730d53afdd..e575080c5d 100644
--- a/its/core-it-suite/src/test/resources/mng-3933/profiles.xml
+++ b/its/core-it-suite/src/test/resources/mng-3933/profiles.xml
@@ -20,38 +20,153 @@ under the License.
-->
+
+ profile-default
+
+
- PROFILE-A
+ profile-default
+
+ DEFAULT-ACTIVATION
+
+
+
+
+
+ profile-os-a
winDOWS
- PASSED
+ OS-FAMILY-ACTIVATION
- PROFILE-B
+ profile-os-b
unIX
- PASSED
+ OS-FAMILY-ACTIVATION
- PROFILE-C
+ profile-os-c
mAC
- PASSED
+ OS-FAMILY-ACTIVATION
+
+
+
+
+
+ profile-jdk
+
+ !1.0
+
+
+ JDK-ACTIVATION
+
+
+
+
+
+ profile-jdk-inactive
+
+ 1.0.0.0
+
+
+ JDK-ACTIVATION
+
+
+
+
+
+ profile-sys-prop
+
+
+ maven.profile.activator
+ test
+
+
+
+ SYS-PROP-ACTIVATION
+
+
+
+
+
+ profile-sys-prop-inactive
+
+
+ maven.profile.inactive
+
+
+
+ SYS-PROP-ACTIVATION
+
+
+
+
+
+ profile-env-prop
+
+
+ env.MAVEN_PROFILE
+ test
+
+
+
+ ENV-PROP-ACTIVATION
+
+
+
+
+
+ profile-env-prop-inactive
+
+
+ env.MAVEN_CORE_IT
+ missing
+
+
+
+ ENV-PROP-ACTIVATION
+
+
+
+
+
+ profile-file-missing
+
+
+ a-funky-file-name-that-most-likely-does-not-exist-on-an-ordinary-box
+
+
+
+ MISSING-FILE-ACTIVATION
+
+
+
+
+
+ profile-file-missing-inactive
+
+
+ a-funky-file-name-that-most-likely-does-not-exist-on-an-ordinary-box
+
+
+
+ MISSING-FILE-ACTIVATION