[MNG-6981] Verify that the --projects switch will include the children of the targeted projects.
This closes #71
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index ed6554f..24fd5b7 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -107,6 +107,7 @@
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng6981ProjectListShouldIncludeChildrenTest.class );
suite.addTestSuite( MavenITmng6972AllowAccessToGraphPackageTest.class );
suite.addTestSuite( MavenITmng6772NestedImportScopeRepositoryOverride.class );
suite.addTestSuite( MavenITmng6759TransitiveDependencyRepositoriesTest.class );
@@ -359,6 +360,7 @@
suite.addTestSuite( MavenITmng4270ArtifactHandlersFromPluginDepsTest.class );
suite.addTestSuite( MavenITmng4269BadReactorResolutionFromOutDirTest.class );
suite.addTestSuite( MavenITmng4262MakeLikeReactorDottedPathTest.class );
+ suite.addTestSuite( MavenITmng4262MakeLikeReactorDottedPath370Test.class );
suite.addTestSuite( MavenITmng4254SelectableWagonProvidersTest.class );
suite.addTestSuite( MavenITmng4238ArtifactHandlerExtensionUsageTest.class );
suite.addTestSuite( MavenITmng4235HttpAuthDeploymentChecksumsTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java
new file mode 100644
index 0000000..388974b
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java
@@ -0,0 +1,91 @@
+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.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-4262">MNG-4262</a>.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4262MakeLikeReactorDottedPath370Test
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng4262MakeLikeReactorDottedPath370Test()
+ {
+ super( "[3.7.0,)" );
+ }
+
+ private void clean( Verifier verifier )
+ throws Exception
+ {
+ verifier.deleteDirectory( "target" );
+ verifier.deleteDirectory( "../sub-a/target" );
+ }
+
+ /**
+ * Verify that the project list can select the root project by its relative path ".".
+ */
+ public void testitMakeRoot()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4262" );
+
+ Verifier verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath() );
+ verifier.setAutoclean( false );
+ clean( verifier );
+ verifier.addCliOption( "-pl" );
+ verifier.addCliOption( "." );
+ verifier.setLogFileName( "log-root.txt" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ verifier.assertFilePresent( "target/touch.txt" );
+ verifier.assertFilePresent( "../sub-a/target/touch.txt" );
+ }
+
+ /**
+ * Verify that the project list can select a sub module by a relative path like "../<something>".
+ */
+ public void testitMakeModule()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4262" );
+
+ Verifier verifier = newVerifier( new File( testDir, "parent" ).getAbsolutePath() );
+ verifier.setAutoclean( false );
+ clean( verifier );
+ verifier.addCliOption( "-pl" );
+ verifier.addCliOption( "../sub-a" );
+ verifier.setLogFileName( "log-module.txt" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ verifier.assertFileNotPresent( "target/touch.txt" );
+ verifier.assertFilePresent( "../sub-a/target/touch.txt" );
+ }
+
+}
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java
index 0daa9f3..0b19956 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java
@@ -35,7 +35,7 @@
public MavenITmng4262MakeLikeReactorDottedPathTest()
{
- super( "[3.0-alpha-3,)" );
+ super( "[3.0-alpha-3,3.7.0)" );
}
private void clean( Verifier verifier )
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java
new file mode 100644
index 0000000..0894390
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java
@@ -0,0 +1,68 @@
+package org.apache.maven.it;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.List;
+
+public class MavenITmng6981ProjectListShouldIncludeChildrenTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ private static final String RESOURCE_PATH = "/mng-6981-pl-should-include-children";
+
+ public MavenITmng6981ProjectListShouldIncludeChildrenTest()
+ {
+ super( "[3.7.0,)" );
+ }
+
+ public void testProjectListShouldIncludeChildrenByDefault()
+ throws Exception
+ {
+ final File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH );
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+
+ verifier.addCliOption( "-pl" );
+ verifier.addCliOption( ":module-a" );
+ verifier.executeGoal( "compile" );
+ verifier.verifyTextInLog( "Building module-a-1 1.0" );
+ }
+
+ /**
+ * Since --pl's behavior is changed, make sure the alternative for building a pom without its children still works.
+ */
+ public void testFileSwitchAllowsExcludeOfChildren()
+ throws Exception
+ {
+ final File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH );
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+
+ verifier.addCliOption( "-f" );
+ verifier.addCliOption( "module-a" );
+ verifier.addCliOption( "--non-recursive" );
+ verifier.setLogFileName( "log-non-recursive.txt" );
+ verifier.executeGoal( "compile" );
+ verifyTextNotInLog( verifier, "Building module-a-1 1.0" );
+ }
+
+ /**
+ * Throws an exception if the text <strong>is</strong> present in the log.
+ *
+ * @param verifier the verifier to use
+ * @param text the text to assert present
+ * @throws VerificationException if text is not found in log
+ */
+ private void verifyTextNotInLog( Verifier verifier, String text )
+ throws VerificationException
+ {
+ List<String> lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
+
+ for ( String line : lines )
+ {
+ if ( Verifier.stripAnsi( line ).contains( text ) )
+ {
+ throw new VerificationException( "Text found in log: " + text );
+ }
+ }
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/module-a-1/pom.xml b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/module-a-1/pom.xml
new file mode 100644
index 0000000..f004e69
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/module-a-1/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>module-a-1</artifactId>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng6981</groupId>
+ <artifactId>module-a</artifactId>
+ <version>1.0</version>
+ </parent>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/pom.xml b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/pom.xml
new file mode 100644
index 0000000..2b1c7fa
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>module-a</artifactId>
+
+ <packaging>pom</packaging>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng6981</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <modules>
+ <module>module-a-1</module>
+ </modules>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/pom.xml b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/pom.xml
new file mode 100644
index 0000000..0d23baf
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng6981</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MNG-6981</name>
+ <description>
+ Test that the --projects flag will include the target project's children in the reactor.
+ </description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ </properties>
+
+ <modules>
+ <module>module-a</module>
+ </modules>
+
+</project>