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 7ba0fc7e5b..b6ef93e7ed 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( MavenITmng4913UserPropertyVsDependencyPomPropertyTest.class ); suite.addTestSuite( MavenITmng4895PluginDepWithNonRelocatedMavenApiTest.class ); suite.addTestSuite( MavenITmng4891RobustSnapshotResolutionTest.class ); suite.addTestSuite( MavenITmng4890MakeLikeReactorConsidersVersionsTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4913UserPropertyVsDependencyPomPropertyTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4913UserPropertyVsDependencyPomPropertyTest.java new file mode 100644 index 0000000000..406434ab38 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4913UserPropertyVsDependencyPomPropertyTest.java @@ -0,0 +1,69 @@ +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-4913. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4913UserPropertyVsDependencyPomPropertyTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4913UserPropertyVsDependencyPomPropertyTest() + { + super( "[2.0.9,3.0-alpha-1),[3.0.2,)" ); + } + + /** + * Verify that user properties from the CLI do not override POM properties of transitive dependencies. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4913" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng4913" ); + verifier.setSystemProperty( "mng4913.version", "98.76" ); + 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 classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + + assertTrue( classpath.toString(), classpath.contains( "a-0.1.jar" ) ); + assertTrue( classpath.toString(), classpath.contains( "b-0.1.jar" ) ); + assertFalse( classpath.toString(), classpath.contains( "a-98.76.jar" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4913/pom.xml b/its/core-it-suite/src/test/resources/mng-4913/pom.xml new file mode 100644 index 0000000000..6fd13eb9da --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4913/pom.xml @@ -0,0 +1,66 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4913 + test + 0.1 + jar + + Maven Integration Test :: MNG-4913 + + Verify that user properties from the CLI do not override POM properties of transitive dependencies. + + + + + + org.apache.maven.its.mng4913 + b + 0.1 + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/classpath.txt + 1 + + + + resolve + validate + + compile + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/a/0.1/a-0.1.jar b/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/a/0.1/a-0.1.jar new file mode 100644 index 0000000000..4e3adbaa00 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/a/0.1/a-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/a/0.1/a-0.1.pom b/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/a/0.1/a-0.1.pom new file mode 100644 index 0000000000..3be0da418f --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/a/0.1/a-0.1.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4913 + a + 0.1 + jar + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/b/0.1/b-0.1.jar b/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/b/0.1/b-0.1.jar new file mode 100644 index 0000000000..3f0ba802c8 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/b/0.1/b-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/b/0.1/b-0.1.pom b/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/b/0.1/b-0.1.pom new file mode 100644 index 0000000000..30c9f5b0f0 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4913/repo/org/apache/maven/its/mng4913/b/0.1/b-0.1.pom @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4913 + b + 0.1 + jar + + + 0.1 + + + + + org.apache.maven.its.mng4913 + a + ${mng4913.version} + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4913/settings-template.xml b/its/core-it-suite/src/test/resources/mng-4913/settings-template.xml new file mode 100644 index 0000000000..c985d1a689 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4913/settings-template.xml @@ -0,0 +1,43 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it + @baseurl@/repo + + ignore + + + false + + + + + + + maven-core-it-repo + +