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 794fb404d5..804df5135d 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 @@ -83,6 +83,7 @@ public class IntegrationTestSuite // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng5137ReactorResolutionInForkedBuildTest.class ); suite.addTestSuite( MavenITmng5135AggregatorDepResolutionModuleExtensionTest.class ); suite.addTestSuite( MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest.class ); suite.addTestSuite( MavenITmng5064SuppressSnapshotUpdatesTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5137ReactorResolutionInForkedBuildTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5137ReactorResolutionInForkedBuildTest.java new file mode 100644 index 0000000000..244d50f214 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5137ReactorResolutionInForkedBuildTest.java @@ -0,0 +1,68 @@ +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.List; + +/** + * This is a test set for MNG-5137. + * + * @author Benjamin Bentmann + */ +public class MavenITmng5137ReactorResolutionInForkedBuildTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng5137ReactorResolutionInForkedBuildTest() + { + super( "[3.0.4,)" ); + } + + /** + * Verify that reactor resolution also works within a forked multi-module lifecycle, i.e. a lifecycle fork caused + * by an aggregator mojo. Here, reactor resolution needs to search the forked project instances for build output, + * not the project instances from the main build. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5137" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteDirectory( "producer/target" ); + verifier.deleteDirectory( "consumer/target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng5137" ); + verifier.executeGoal( + "org.apache.maven.its.plugins:maven-it-plugin-fork:2.1-SNAPSHOT:fork-lifecycle-aggregator" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List compile = verifier.loadLines( "consumer/target/compile.txt", "UTF-8" ); + + assertTrue( compile.toString(), compile.contains( "producer/pom.xml" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-5137/consumer/pom.xml b/its/core-it-suite/src/test/resources/mng-5137/consumer/pom.xml new file mode 100644 index 0000000000..11dcf7afd0 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5137/consumer/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng5137 + consumer + 0.1 + jar + + Maven Integration Test :: MNG-5137 :: Consumer + + Verify that reactor resolution also works within a forked multi-module lifecycle, i.e. a lifecycle fork caused + by an aggregator mojo. Here, reactor resolution needs to search the forked project instances for build output, + not the project instances from the main build. + + + + + org.apache.maven.its.mng5137 + producer + 0.1 + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + 2 + + + + resolve + initialize + + compile + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5137/pom.xml b/its/core-it-suite/src/test/resources/mng-5137/pom.xml new file mode 100644 index 0000000000..3a069f0b08 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5137/pom.xml @@ -0,0 +1,41 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng5137 + test + 0.1 + pom + + Maven Integration Test :: MNG-5137 + + Verify that reactor resolution also works within a forked multi-module lifecycle, i.e. a lifecycle fork caused + by an aggregator mojo. Here, reactor resolution needs to search the forked project instances for build output, + not the project instances from the main build. + + + + producer + consumer + + diff --git a/its/core-it-suite/src/test/resources/mng-5137/producer/pom.xml b/its/core-it-suite/src/test/resources/mng-5137/producer/pom.xml new file mode 100644 index 0000000000..522b8ec463 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5137/producer/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng5137 + producer + 0.1 + jar + + Maven Integration Test :: MNG-5137 :: Producer + + Verify that reactor resolution also works within a forked multi-module lifecycle, i.e. a lifecycle fork caused + by an aggregator mojo. Here, reactor resolution needs to search the forked project instances for build output, + not the project instances from the main build. + + + + + + org.apache.maven.its.plugins + maven-it-plugin-artifact + 2.1-SNAPSHOT + + + package + initialize + + pom.xml + + + set + + + + + + +