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 c8bced7ca..ef7b16c4a 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 @@ -109,6 +109,7 @@ public static Test suite() suite.addTestSuite( MavenITmng6330RelativePath.class ); suite.addTestSuite( MavenITmng6240PluginExtensionAetherProvider.class ); suite.addTestSuite( MavenITmng6223FindBasedir.class ); + suite.addTestSuite( MavenITmng5527DependencyManagementImportRelocationsTest.class ); suite.addTestSuite( MavenITmng6189SiteReportPluginsWarningTest.class ); suite.addTestSuite( MavenITmng6127PluginExecutionConfigurationInterferenceTest.class ); suite.addTestSuite( MavenITmng6057CheckReactorOrderTest.class ); diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5527DependencyManagementImportRelocationsTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5527DependencyManagementImportRelocationsTest.java new file mode 100644 index 000000000..27c9360c7 --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5527DependencyManagementImportRelocationsTest.java @@ -0,0 +1,74 @@ +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 java.io.File; +import java.util.Arrays; +import java.util.Map; +import java.util.Properties; + +import org.apache.maven.it.util.ResourceExtractor; + +import static junit.framework.Assert.assertEquals; + +/** + * [MNG-5527] Dependency management import should support relocations. + * + * @author Christian Schulte + */ +public class MavenITmng5527DependencyManagementImportRelocationsTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng5527DependencyManagementImportRelocationsTest() + { + super( "[3.4.0,)" ); + } + + public void testCanRelocateDependencyManagementImport() + throws Exception + { + final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5527/relocations" ); + + final Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", + (Map) verifier.newDefaultFilterProperties() ); + + verifier.addCliOption( "-s" ); + verifier.addCliOption( "settings.xml" ); + verifier.executeGoals( Arrays.asList( new String[] + { + "clean", "verify" + } ) ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier.verifyTextInLog( "LEVEL_1" ); + verifier.verifyTextInLog( "LEVEL_2" ); + + final Properties properties = verifier.loadProperties( "target/project.properties" ); + assertEquals( "1", properties.getProperty( "project.dependencyManagement.dependencies" ) ); + assertEquals( "group-id-to-import:artifact-id-to-import:jar", + properties.getProperty( "project.dependencyManagement.dependencies.0.managementKey" ) ); + + } + +} diff --git a/core-it-suite/src/test/resources/mng-5527/relocations/pom.xml b/core-it-suite/src/test/resources/mng-5527/relocations/pom.xml new file mode 100644 index 000000000..822f1cf04 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5527/relocations/pom.xml @@ -0,0 +1,72 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng5527 + 0 + 2016062 + pom + + Maven Integration Test :: MNG-5527 + + + Tests that dependency management import relocations are supported. + + + + + + org.apache.maven.its.mng5527.relocated1 + bom + 0 + pom + import + + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + verify + + eval + + + + project/dependencyManagement + + ${project.build.directory}/project.properties + + + + + + + + diff --git a/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated1/bom/0/bom-0.pom b/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated1/bom/0/bom-0.pom new file mode 100644 index 000000000..9fd2234df --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated1/bom/0/bom-0.pom @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng5527.relocated1 + bom + 0 + pom + + + + + level1-group-id-must-not-be-imported + level1-artifact-id-must-not-be-imported + level1-version-must-not-be-imported + + + + + + + org.apache.maven.its.mng5527.relocated2 + bom + 0 + LEVEL_1 + + + diff --git a/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated2/bom/0/bom-0.pom b/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated2/bom/0/bom-0.pom new file mode 100644 index 000000000..cc5aa27e7 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated2/bom/0/bom-0.pom @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng5527.relocated2 + bom + 0 + pom + + + + + level2-group-id-must-not-be-imported + level2-artifact-id-must-not-be-imported + level2-version-must-not-be-imported + + + + + + + org.apache.maven.its.mng5527.relocated3 + bom + 0 + LEVEL_2 + + + diff --git a/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated3/bom/0/bom-0.pom b/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated3/bom/0/bom-0.pom new file mode 100644 index 000000000..35c729ecc --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated3/bom/0/bom-0.pom @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng5527.relocated3 + bom + 0 + pom + + + + + group-id-to-import + artifact-id-to-import + version-to-import + + + + diff --git a/core-it-suite/src/test/resources/mng-5527/settings-template.xml b/core-it-suite/src/test/resources/mng-5527/settings-template.xml new file mode 100644 index 000000000..f22a7f357 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5527/settings-template.xml @@ -0,0 +1,43 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it + @baseurl@/../repo + + ignore + + + false + + + + + + + maven-core-it-repo + +