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 c8b5df9802..82c7bd280d 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 @@ -81,6 +81,7 @@ public class IntegrationTestSuite // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4800NearestWinsVsScopeWideningTest.class ); suite.addTestSuite( MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest.class ); suite.addTestSuite( MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.class ); suite.addTestSuite( MavenITmng4789ScopeInheritanceMeetsConflictTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4800NearestWinsVsScopeWideningTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4800NearestWinsVsScopeWideningTest.java new file mode 100644 index 0000000000..30b5a0bf64 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4800NearestWinsVsScopeWideningTest.java @@ -0,0 +1,96 @@ +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-4800. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4800NearestWinsVsScopeWideningTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4800NearestWinsVsScopeWideningTest() + { + super( "[3.0-beta-4,)" ); + } + + public void testitAB() + throws Exception + { + testit( "test-ab" ); + } + + public void testitBA() + throws Exception + { + testit( "test-ba" ); + } + + /** + * Verify that nearest-wins conflict resolution doesn't get confused when a farther conflicting dependency has + * a wider scope than the nearer dependency, i.e. one should still end up with the nearer dependency (s:1) and + * its sub tree (x) but in the wider scope (compile). + */ + private void testit( String test ) + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4800" ); + + Verifier verifier = newVerifier( new File( testDir, test ).getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng4800" ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( "settings.xml" ); + verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); + + assertTrue( test + " > " + compile.toString(), compile.contains( "b-0.1.jar" ) ); + assertTrue( test + " > " + compile.toString(), compile.contains( "c-0.1.jar" ) ); + assertTrue( test + " > " + compile.toString(), compile.contains( "s-0.1.jar" ) ); + assertTrue( test + " > " + compile.toString(), compile.contains( "x-0.1.jar" ) ); + assertFalse( test + " > " + compile.toString(), compile.contains( "a-0.1.jar" ) ); + assertFalse( test + " > " + compile.toString(), compile.contains( "s-0.2.jar" ) ); + assertFalse( test + " > " + compile.toString(), compile.contains( "y-0.1.jar" ) ); + + List runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" ); + + assertTrue( test + " > " + runtime.toString(), runtime.contains( "b-0.1.jar" ) ); + assertTrue( test + " > " + runtime.toString(), runtime.contains( "c-0.1.jar" ) ); + assertTrue( test + " > " + runtime.toString(), runtime.contains( "s-0.1.jar" ) ); + assertTrue( test + " > " + runtime.toString(), runtime.contains( "x-0.1.jar" ) ); + assertTrue( test + " > " + runtime.toString(), runtime.contains( "a-0.1.jar" ) ); + assertFalse( test + " > " + runtime.toString(), runtime.contains( "s-0.2.jar" ) ); + assertFalse( test + " > " + runtime.toString(), runtime.contains( "y-0.1.jar" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/a/0.1/a-0.1.jar b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/a/0.1/a-0.1.jar new file mode 100644 index 0000000000..163c672118 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/a/0.1/a-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/a/0.1/a-0.1.pom b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/a/0.1/a-0.1.pom new file mode 100644 index 0000000000..2f3bf0634a --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/a/0.1/a-0.1.pom @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + a + 0.1 + jar + + + + org.apache.maven.its.mng4800 + s + 0.1 + compile + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/b/0.1/b-0.1.jar b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/b/0.1/b-0.1.jar new file mode 100644 index 0000000000..1f69258a56 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/b/0.1/b-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/b/0.1/b-0.1.pom b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/b/0.1/b-0.1.pom new file mode 100644 index 0000000000..80e515bcf2 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/b/0.1/b-0.1.pom @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + b + 0.1 + jar + + + + org.apache.maven.its.mng4800 + c + 0.1 + compile + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/c/0.1/c-0.1.jar b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/c/0.1/c-0.1.jar new file mode 100644 index 0000000000..69d9a70785 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/c/0.1/c-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/c/0.1/c-0.1.pom b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/c/0.1/c-0.1.pom new file mode 100644 index 0000000000..687e1110e8 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/c/0.1/c-0.1.pom @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + c + 0.1 + jar + + + + org.apache.maven.its.mng4800 + s + 0.2 + compile + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.1/s-0.1.jar b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.1/s-0.1.jar new file mode 100644 index 0000000000..f589f095e6 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.1/s-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.1/s-0.1.pom b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.1/s-0.1.pom new file mode 100644 index 0000000000..22b83ed14f --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.1/s-0.1.pom @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + s + 0.1 + jar + + + + org.apache.maven.its.mng4800 + x + 0.1 + compile + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.2/s-0.2.jar b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.2/s-0.2.jar new file mode 100644 index 0000000000..7d2546e74e Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.2/s-0.2.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.2/s-0.2.pom b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.2/s-0.2.pom new file mode 100644 index 0000000000..0faddacf1c --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/s/0.2/s-0.2.pom @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + s + 0.2 + jar + + + + org.apache.maven.its.mng4800 + y + 0.1 + compile + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/x/0.1/x-0.1.jar b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/x/0.1/x-0.1.jar new file mode 100644 index 0000000000..b7841627df Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/x/0.1/x-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/x/0.1/x-0.1.pom b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/x/0.1/x-0.1.pom new file mode 100644 index 0000000000..9c89a66ef4 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/x/0.1/x-0.1.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + x + 0.1 + jar + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/y/0.1/y-0.1.jar b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/y/0.1/y-0.1.jar new file mode 100644 index 0000000000..703a365576 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/y/0.1/y-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/y/0.1/y-0.1.pom b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/y/0.1/y-0.1.pom new file mode 100644 index 0000000000..0595e50a60 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/repo/org/apache/maven/its/mng4800/y/0.1/y-0.1.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + y + 0.1 + jar + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/settings-template.xml b/its/core-it-suite/src/test/resources/mng-4800/settings-template.xml new file mode 100644 index 0000000000..f22a7f3570 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/settings-template.xml @@ -0,0 +1,43 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it + @baseurl@/../repo + + ignore + + + false + + + + + + + maven-core-it-repo + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/test-ab/pom.xml b/its/core-it-suite/src/test/resources/mng-4800/test-ab/pom.xml new file mode 100644 index 0000000000..9487143ee2 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/test-ab/pom.xml @@ -0,0 +1,87 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + ab + 0.1 + jar + + Maven Integration Test :: MNG-4800 + + Verify that nearest-wins conflict resolution doesn't get confused when a farther conflicting dependency has + a wider scope than the nearer dependency, i.e. one should still end up with the nearer dependency (s:1) and + its sub tree (x) but in the wider scope (compile). + + + + + + org.apache.maven.its.mng4800 + a + 0.1 + + runtime + + + org.apache.maven.its.mng4800 + b + 0.1 + compile + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + target/runtime.txt + 1 + + + + resolve + validate + + compile + runtime + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4800/test-ba/pom.xml b/its/core-it-suite/src/test/resources/mng-4800/test-ba/pom.xml new file mode 100644 index 0000000000..4e83f3a67b --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4800/test-ba/pom.xml @@ -0,0 +1,87 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4800 + ba + 0.1 + jar + + Maven Integration Test :: MNG-4800 + + Verify that nearest-wins conflict resolution doesn't get confused when a farther conflicting dependency has + a wider scope than the nearer dependency, i.e. one should still end up with the nearer dependency (s:1) and + its sub tree (x) but in the wider scope (compile). + + + + + + org.apache.maven.its.mng4800 + b + 0.1 + compile + + + org.apache.maven.its.mng4800 + a + 0.1 + + runtime + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + target/runtime.txt + 1 + + + + resolve + validate + + compile + runtime + + + + + + +