diff --git a/its/.gitignore b/its/.gitignore index fa65a79206..5fb5e3a1b1 100644 --- a/its/.gitignore +++ b/its/.gitignore @@ -11,3 +11,4 @@ bin .DS_Store .idea jvz-* +.flattened-pom.xml 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 272a85989b..bbc7c9ee9e 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 @@ -106,6 +106,9 @@ public class IntegrationTestSuite // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng6057CheckReactorOrderTest.class ); + suite.addTestSuite( MavenITmng5895CIFriendlyUsageWithPropertyTest.class ); + suite.addTestSuite( MavenITmng6090CIFriendlyTest.class ); suite.addTestSuite( MavenITmng6173GetProjectsAndDependencyGraphTest.class ); suite.addTestSuite( MavenITmng6173GetAllProjectsInReactorTest.class ); suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5895CIFriendlyUsageWithPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5895CIFriendlyUsageWithPropertyTest.java new file mode 100644 index 0000000000..7d13fd4c5a --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5895CIFriendlyUsageWithPropertyTest.java @@ -0,0 +1,70 @@ +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; + +/** + * The usage of a ${revision} for the version in the pom file and furthermore + * defining the property in the pom file and overwrite it via command line. + * MNG-5895. + * + * This will result in a failure without the fix for this issue. + * + * @author Karl Heinz Marbaise khmarbaise@apache.org + */ +public class MavenITmng5895CIFriendlyUsageWithPropertyTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng5895CIFriendlyUsageWithPropertyTest() + { + // The first version which contains the fix for the MNG-issue. + // TODO: Think about it! + super( "[3.5.0-alpha-2,)" ); + } + + /** + * Check that the resulting run will not fail in case + * of defining the property via command line which is + * already defined inside the pom. + */ + public void testitShouldResolveTheDependencies() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5895-ci-friendly-usage-with-property" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); + verifier.setMavenDebug( false ); + verifier.setAutoclean( false ); + + //verifier.setLogFileName( "log-only.txt" ); + verifier.addCliOption( "-Drevision=1.2" ); + verifier.executeGoal( "clean" ); + verifier.executeGoal( "package" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + } + +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java new file mode 100644 index 0000000000..13a009c737 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6057CheckReactorOrderTest.java @@ -0,0 +1,119 @@ +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.LinkedList; +import java.util.List; + +/** + * Using a ${revision} in the version will change the reactor order before fixing + * MNG-6057. Without the fix for this issue the order of + * the reactor is changed in that way that the parent is ordered to the last position instead of the first position. + * + * @author Karl Heinz Marbaise khmarbaise@apache.org + */ +public class MavenITmng6057CheckReactorOrderTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng6057CheckReactorOrderTest() + { + // The first version which contains the fix for the MNG-6057 issue. + // TODO: Think about it! + super( "[3.5.0-alpha-2,)" ); + } + + /** + * Verify that the result shows the reactor order as expected. + */ + public void testitReactorShouldResultInExpectedOrder() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6057-check-reactor-order" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); + verifier.setMavenDebug( false ); + verifier.setAutoclean( false ); + + verifier.setLogFileName( "log-only.txt" ); + verifier.addCliOption( "-Drevision=1.3.0-SNAPSHOT" ); + verifier.executeGoal( "clean" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List loadedLines = verifier.loadLines( "log-only.txt", "UTF-8" ); + List resultingLines = extractReactorBuildOrder( loadedLines ); + + // We expecting exactly three lines as result. + assertEquals( 3, resultingLines.size() ); + + // We expect those lines in the following exact order. + assertEquals( "[INFO] base-project", resultingLines.get( 0 ) ); + assertEquals( "[INFO] module-1", resultingLines.get( 1 ) ); + assertEquals( "[INFO] module-2", resultingLines.get( 2 ) ); + } + + /** + * Extract the lines at the beginning of the Maven output: + * + *
+     * [INFO] Reactor Build Order:
+     * [INFO]
+     * [INFO] module-1
+     * [INFO] module-2
+     * [INFO] base-project
+     * [INFO]
+     * 
+ */ + private List extractReactorBuildOrder( List loadedLines ) + { + List resultingLines = new LinkedList(); + boolean start = false; + for ( String line : loadedLines ) + { + if ( start ) + { + if ( line.startsWith( "[INFO] ----------------------------" ) ) + { + start = false; + } + else if ( !line.endsWith( "[INFO] " ) ) + { + resultingLines.add( line ); + } + } + else + { + if ( line.startsWith( "[INFO] Reactor Build Order:" ) ) + { + start = true; + } + + } + } + return resultingLines; + + } + +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6090CIFriendlyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6090CIFriendlyTest.java new file mode 100644 index 0000000000..77b72481f9 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6090CIFriendlyTest.java @@ -0,0 +1,80 @@ +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.Arrays; + +/** + * The usage of a ${revision} for the version in the pom file and furthermore + * defining the property in the pom file and overwrite it via command line and + * try to build a partial reactor via mvn -pl .. + * MNG-6090. + * + * @author Karl Heinz Marbaise khmarbaise@apache.org + */ +public class MavenITmng6090CIFriendlyTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng6090CIFriendlyTest() + { + // The first version which contains the fix for the MNG-issue. + // TODO: Think about it! + super( "[3.5.0-alpha-2,)" ); + } + + /** + * Check that the resulting run will not fail in case + * of defining the property via command line and + * install the projects and afterwards just build + * a part of the whole reactor. + */ + public void testitShouldResolveTheDependencies() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6090-ci-friendly" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); + verifier.setMavenDebug( false ); + verifier.setAutoclean( false ); + + verifier.addCliOption( "-Drevision=1.2" ); + verifier.setLogFileName( "install-log.txt" ); + verifier.executeGoals( Arrays.asList( "clean", "install" ) ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier = newVerifier( testDir.getAbsolutePath(), false ); + verifier.setMavenDebug( false ); + verifier.setAutoclean( false ); + + verifier.addCliOption( "-Drevision=1.2" ); + verifier.addCliOption( "-pl module-3" ); + verifier.executeGoal( "package" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + } + +} diff --git a/its/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml b/its/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml index b48464ef92..7c5c03c98a 100644 --- a/its/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml +++ b/its/core-it-suite/src/test/resources/bootstrap/group-6/pom.xml @@ -88,5 +88,77 @@ under the License. 3.1 runtime + + + org.apache.maven + maven-settings + 3.1.1 + + + org.apache.maven + maven-settings-builder + 3.1.1 + + + org.apache.maven + maven-repository-metadata + 3.1.1 + + + org.apache.maven + maven-aether-provider + 3.1.1 + + + org.eclipse.aether + aether-spi + 0.9.0.M2 + + + org.eclipse.aether + aether-impl + 0.9.0.M2 + + + org.eclipse.sisu + org.eclipse.sisu.plexus + 0.0.0.M5 + + + org.eclipse.sisu + org.eclipse.sisu.inject + 0.0.0.M5 + + + org.sonatype.sisu + sisu-guice + 3.1.0 + no_aop + + + com.google.guava + guava + 10.0.1 + + + com.google.code.findbugs + jsr305 + 1.3.9 + + + org.codehaus.plexus + plexus-classworlds + 2.5.1 + + + org.codehaus.mojo + flatten-maven-plugin + 1.0.0 + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.1 + diff --git a/its/core-it-suite/src/test/resources/bootstrap/pom.xml b/its/core-it-suite/src/test/resources/bootstrap/pom.xml index e7aa995fab..8ef3a14b75 100644 --- a/its/core-it-suite/src/test/resources/bootstrap/pom.xml +++ b/its/core-it-suite/src/test/resources/bootstrap/pom.xml @@ -88,6 +88,16 @@ under the License. maven-surefire-plugin 2.12.4 + + org.codehaus.mojo + flatten-maven-plugin + 1.0.0 + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.1 + org.apache.maven.plugins maven-dependency-plugin diff --git a/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-1/pom.xml b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-1/pom.xml new file mode 100644 index 0000000000..e9ac53d817 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-1/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + mng-5895-ci-friendly-usage-with-property + base-project + ${revision} + + + module-1 + + diff --git a/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-2/pom.xml b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-2/pom.xml new file mode 100644 index 0000000000..ac532d3ed5 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-2/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + + mng-5895-ci-friendly-usage-with-property + base-project + ${revision} + + module-2 + + + + mng-5895-ci-friendly-usage-with-property + module-1 + ${project.version} + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-3/jar-with-prod.xml b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-3/jar-with-prod.xml new file mode 100644 index 0000000000..65b31bbc5d --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-3/jar-with-prod.xml @@ -0,0 +1,17 @@ + + prod + + jar + + false + + + / + false + true + runtime + + + \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-3/pom.xml b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-3/pom.xml new file mode 100644 index 0000000000..e51f0fb12a --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/module-3/pom.xml @@ -0,0 +1,56 @@ + + + + + + 4.0.0 + + + mng-5895-ci-friendly-usage-with-property + base-project + ${revision} + + module-3 + + + + mng-5895-ci-friendly-usage-with-property + module-2 + ${project.version} + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + assemblies + package + + single + + + + jar-with-prod.xml + + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/pom.xml b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/pom.xml new file mode 100644 index 0000000000..38a3358133 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5895-ci-friendly-usage-with-property/pom.xml @@ -0,0 +1,55 @@ + + + + + + 4.0.0 + + mng-5895-ci-friendly-usage-with-property + base-project + ${revision} + pom + + + 1.3.0-SNAPSHOT + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.1 + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + + + module-3 + module-1 + module-2 + + diff --git a/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/module-1/pom.xml b/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/module-1/pom.xml new file mode 100644 index 0000000000..fe4baff346 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/module-1/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + mng-6057-check-reactor-order + base-project + ${revision} + + + module-1 + pom + + diff --git a/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/module-2/pom.xml b/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/module-2/pom.xml new file mode 100644 index 0000000000..d33c1c96d5 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/module-2/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + + mng-6057-check-reactor-order + base-project + ${revision} + + module-2 + + + + mng-6057-check-reactor-order + module-1 + ${project.version} + + + diff --git a/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/pom.xml b/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/pom.xml new file mode 100644 index 0000000000..dbc9d39dac --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-6057-check-reactor-order/pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + + mng-6057-check-reactor-order + base-project + ${revision} + pom + + + module-1 + module-2 + + diff --git a/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-1/pom.xml b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-1/pom.xml new file mode 100644 index 0000000000..b0577aaab5 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-1/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + mng-6090-ci-friendly + base-project + ${revision} + + + module-1 + + diff --git a/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-2/pom.xml b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-2/pom.xml new file mode 100644 index 0000000000..5b99f84cb1 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-2/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + + mng-6090-ci-friendly + base-project + ${revision} + + module-2 + + + + mng-6090-ci-friendly + module-1 + ${project.version} + + + + diff --git a/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-3/jar-with-prod.xml b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-3/jar-with-prod.xml new file mode 100644 index 0000000000..65b31bbc5d --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-3/jar-with-prod.xml @@ -0,0 +1,17 @@ + + prod + + jar + + false + + + / + false + true + runtime + + + \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-3/pom.xml b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-3/pom.xml new file mode 100644 index 0000000000..a3f7236ec1 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/module-3/pom.xml @@ -0,0 +1,57 @@ + + + + + + 4.0.0 + + + mng-6090-ci-friendly + base-project + ${revision} + + module-3 + + + + mng-6090-ci-friendly + module-2 + ${project.version} + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.1 + + + assemblies + package + + single + + + + jar-with-prod.xml + + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/pom.xml b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/pom.xml new file mode 100644 index 0000000000..233c4cdb07 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-6090-ci-friendly/pom.xml @@ -0,0 +1,86 @@ + + + + + + 4.0.0 + + mng-6090-ci-friendly + base-project + ${revision} + pom + + + 1.3.0-SNAPSHOT + + + module-3 + module-1 + module-2 + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.1 + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + org.codehaus.mojo + flatten-maven-plugin + 1.0.0 + + + + + + org.codehaus.mojo + flatten-maven-plugin + + true + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + + + +