You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ma...@apache.org on 2021/04/02 14:13:23 UTC

[maven-integration-testing] branch master updated: [MNG-7112] Test that --non-recursive can be used together with --projects to just build the aggregator project.

This is an automated email from the ASF dual-hosted git repository.

martinkanters pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git


The following commit(s) were added to refs/heads/master by this push:
     new 56f4d9e  [MNG-7112] Test that --non-recursive can be used together with --projects to just build the aggregator project.
56f4d9e is described below

commit 56f4d9e3b7dead4acb470ec42f124e0d34742878
Author: Martin Kanters <ma...@apache.org>
AuthorDate: Mon Mar 8 16:30:42 2021 +0100

    [MNG-7112] Test that --non-recursive can be used together with --projects to just build the aggregator project.
    
    Closes #104
---
 .../org/apache/maven/it/IntegrationTestSuite.java  |  1 +
 ...MavenITmng7112ProjectsWithNonRecursiveTest.java | 78 ++++++++++++++++++++++
 .../aggregator-a/module-a/pom.xml                  | 44 ++++++++++++
 .../aggregator-a/pom.xml                           | 50 ++++++++++++++
 .../aggregator-b/module-b/pom.xml                  | 44 ++++++++++++
 .../aggregator-b/pom.xml                           | 50 ++++++++++++++
 .../mng-7112-projects-with-non-recursive/pom.xml   | 73 ++++++++++++++++++++
 7 files changed, 340 insertions(+)

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 812541b..e2832ef 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
@@ -106,6 +106,7 @@ public class IntegrationTestSuite
         // Tests that don't run stable and need to be fixed
         // -------------------------------------------------------------------------------------------------------------
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+        suite.addTestSuite( MavenITmng7112ProjectsWithNonRecursiveTest.class );
         suite.addTestSuite( MavenITmng7128BlockExternalHttpReactorTest.class );
         suite.addTestSuite( MavenITmng6511OptionalProjectSelectionTest.class );
         suite.addTestSuite( MavenITmng7110ExtensionClassloader.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7112ProjectsWithNonRecursiveTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7112ProjectsWithNonRecursiveTest.java
new file mode 100644
index 0000000..da9d9d4
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7112ProjectsWithNonRecursiveTest.java
@@ -0,0 +1,78 @@
+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;
+import java.io.IOException;
+
+public class MavenITmng7112ProjectsWithNonRecursiveTest
+        extends AbstractMavenIntegrationTestCase
+{
+    private static final String PROJECT_PATH = "/mng-7112-projects-with-non-recursive";
+
+    public MavenITmng7112ProjectsWithNonRecursiveTest()
+    {
+        super( "[4.0.0-alpha-1,)" );
+    }
+
+    public void testAggregatesCanBeBuiltNonRecursively()
+            throws IOException, VerificationException
+    {
+        final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH );
+        newVerifier( projectDir.getAbsolutePath() ).executeGoal( "clean" );
+
+        final Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
+
+        verifier.addCliOption( "-pl" );
+        verifier.addCliOption( ":aggregator-a,:aggregator-b" );
+        verifier.addCliOption( "-N" );
+        verifier.setLogFileName( "selected-non-recursive.txt" );
+        verifier.executeGoal( "validate" );
+
+        verifier.assertFileNotPresent( "target/touch.txt" );
+        verifier.assertFilePresent( "aggregator-a/target/touch.txt" );
+        verifier.assertFileNotPresent( "aggregator-a/module-a/target/touch.txt" );
+        verifier.assertFilePresent( "aggregator-b/target/touch.txt" );
+        verifier.assertFileNotPresent( "aggregator-b/module-b/target/touch.txt" );
+    }
+
+    public void testAggregatesCanBeDeselectedNonRecursively()
+            throws IOException, VerificationException
+    {
+        final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH );
+        newVerifier( projectDir.getAbsolutePath() ).executeGoal( "clean" );
+
+        final Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
+
+        verifier.addCliOption( "-pl" );
+        verifier.addCliOption( "!:aggregator-a,!:aggregator-b" );
+        verifier.addCliOption( "-N" );
+        verifier.setLogFileName( "excluded-non-recursive.txt" );
+        verifier.executeGoal( "validate" );
+
+        verifier.assertFilePresent( "target/touch.txt" );
+        verifier.assertFileNotPresent( "aggregator-a/target/touch.txt" );
+        verifier.assertFilePresent( "aggregator-a/module-a/target/touch.txt" );
+        verifier.assertFileNotPresent( "aggregator-b/target/touch.txt" );
+        verifier.assertFilePresent( "aggregator-b/module-b/target/touch.txt" );
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-a/module-a/pom.xml b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-a/module-a/pom.xml
new file mode 100644
index 0000000..5be4706
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-a/module-a/pom.xml
@@ -0,0 +1,44 @@
+<?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/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>module-a</artifactId>
+
+    <parent>
+        <groupId>org.apache.maven.its.mng7112</groupId>
+        <artifactId>aggregator-a</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.its.plugins</groupId>
+                <artifactId>maven-it-plugin-log-file</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-a/pom.xml b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-a/pom.xml
new file mode 100644
index 0000000..81fbb54
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-a/pom.xml
@@ -0,0 +1,50 @@
+<?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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>aggregator-a</artifactId>
+    <version>1.0</version>
+
+    <packaging>pom</packaging>
+
+    <parent>
+        <groupId>org.apache.maven.its.mng7112</groupId>
+        <artifactId>aggregator</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <modules>
+        <module>module-a</module>
+    </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.its.plugins</groupId>
+                <artifactId>maven-it-plugin-log-file</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-b/module-b/pom.xml b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-b/module-b/pom.xml
new file mode 100644
index 0000000..dfe26dc
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-b/module-b/pom.xml
@@ -0,0 +1,44 @@
+<?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/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>module-b</artifactId>
+
+    <parent>
+        <groupId>org.apache.maven.its.mng7112</groupId>
+        <artifactId>aggregator-b</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.its.plugins</groupId>
+                <artifactId>maven-it-plugin-log-file</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-b/pom.xml b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-b/pom.xml
new file mode 100644
index 0000000..0220935
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/aggregator-b/pom.xml
@@ -0,0 +1,50 @@
+<?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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>aggregator-b</artifactId>
+    <version>1.0</version>
+
+    <packaging>pom</packaging>
+
+    <parent>
+        <groupId>org.apache.maven.its.mng7112</groupId>
+        <artifactId>aggregator</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <modules>
+        <module>module-b</module>
+    </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.its.plugins</groupId>
+                <artifactId>maven-it-plugin-log-file</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/pom.xml b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/pom.xml
new file mode 100644
index 0000000..149b381
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7112-projects-with-non-recursive/pom.xml
@@ -0,0 +1,73 @@
+<?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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.maven.its.mng7112</groupId>
+    <artifactId>aggregator</artifactId>
+    <version>1.0</version>
+
+    <packaging>pom</packaging>
+
+    <name>Maven Integration Test :: MNG-7112</name>
+    <description>
+        Test that --non-recursive can be used together with --projects to just build the aggregator project.
+    </description>
+
+    <modules>
+        <module>aggregator-a</module>
+        <module>aggregator-b</module>
+    </modules>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.its.plugins</groupId>
+                    <artifactId>maven-it-plugin-log-file</artifactId>
+                    <version>2.1-SNAPSHOT</version>
+                    <configuration>
+                        <logFile>target/touch.txt</logFile>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <id>test</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>reset</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.its.plugins</groupId>
+                <artifactId>maven-it-plugin-log-file</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>