Skip to content

Commit 556107e

Browse files
authored
[MNG-8360] IT for subproject profile activation (#396)
1 parent 68e96d4 commit 556107e

File tree

6 files changed

+112
-0
lines changed

6 files changed

+112
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.maven.it;
20+
21+
import java.io.File;
22+
23+
import org.apache.maven.shared.verifier.Verifier;
24+
import org.apache.maven.shared.verifier.util.ResourceExtractor;
25+
import org.junit.jupiter.api.Test;
26+
27+
/**
28+
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-8341">MNG-8341</a>.
29+
*/
30+
class MavenITmng8360SubprojectProfileActivationTest extends AbstractMavenIntegrationTestCase {
31+
32+
MavenITmng8360SubprojectProfileActivationTest() {
33+
super("[4.0.0-beta-6,)");
34+
}
35+
36+
/**
37+
* Verify that the build succeeds
38+
*/
39+
@Test
40+
void testDeadlock() throws Exception {
41+
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8360");
42+
43+
Verifier verifier = newVerifier(testDir.getAbsolutePath());
44+
verifier.addCliArguments("-s", "settings.xml");
45+
verifier.addCliArguments("-f", "module1");
46+
verifier.addCliArgument("org.apache.maven.plugins:maven-help-plugin:3.3.0:active-profiles");
47+
verifier.execute();
48+
verifier.verifyErrorFreeLog();
49+
50+
// verify the three profiles have been activated
51+
verifier.verifyTextInLog("settings-xml-activeProfiles");
52+
verifier.verifyTextInLog("profile_active_from_mvn_config");
53+
verifier.verifyTextInLog("profile_active_from_condition");
54+
}
55+
}

core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public TestSuiteOrdering() {
120120
* the tests are to finishing. Newer tests are also more likely to fail, so this is
121121
* a fail fast technique as well.
122122
*/
123+
suite.addTestSuite(MavenITmng8360SubprojectProfileActivationTest.class);
123124
suite.addTestSuite(MavenITmng8347TransitiveDependencyManagerTest.class);
124125
suite.addTestSuite(MavenITmng8341DeadlockTest.class);
125126
suite.addTestSuite(MavenITmng8331VersionedAndUnversionedDependenciesTest.class);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-P profile_active_from_mvn_config
2+
-Dprofile_active_from_condition=true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.1.0">
3+
<parent />
4+
<artifactId>module1</artifactId>
5+
<packaging>pom</packaging>
6+
</project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.1.0" root="true">
3+
<groupId>com.github.mattnelson</groupId>
4+
<artifactId>profiles</artifactId>
5+
<version>1.0.0-SNAPSHOT</version>
6+
<packaging>pom</packaging>
7+
<profiles>
8+
<profile>
9+
<id>profile_active_by_default</id>
10+
<activation>
11+
<activeByDefault>true</activeByDefault>
12+
</activation>
13+
<properties>
14+
<profile_active_by_default>parent</profile_active_by_default>
15+
</properties>
16+
</profile>
17+
<profile>
18+
<id>profile_active_from_mvn_config</id>
19+
<properties>
20+
<profile_active_from_mvn_config>parent</profile_active_from_mvn_config>
21+
</properties>
22+
</profile>
23+
<profile>
24+
<id>profile_active_from_condition</id>
25+
<activation>
26+
<property>
27+
<name>profile_active_from_condition</name>
28+
</property>
29+
</activation>
30+
<properties>
31+
<profile_active_from_condition>parent</profile_active_from_condition>
32+
</properties>
33+
</profile>
34+
</profiles>
35+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
4+
<interactiveMode>false</interactiveMode>
5+
<activeProfiles>
6+
<activeProfile>settings-xml-activeProfiles</activeProfile>
7+
</activeProfiles>
8+
<profiles>
9+
<profile>
10+
<id>settings-xml-activeProfiles</id>
11+
</profile>
12+
</profiles>
13+
</settings>

0 commit comments

Comments
 (0)