[MNG-5527] Dependency management import should support relocations.
Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/83b4b5b6 Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/83b4b5b6 Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/83b4b5b6 Branch: refs/heads/DEPMGMT-IMPORT Commit: 83b4b5b62c6fca16e7af878b5cec2d3dc16fb117 Parents: 1359a0a Author: Christian Schulte <schu...@apache.org> Authored: Wed Jun 22 17:41:42 2016 +0200 Committer: Christian Schulte <schu...@apache.org> Committed: Tue Jan 31 01:47:05 2017 +0100 ---------------------------------------------------------------------- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...pendencyManagementImportRelocationsTest.java | 74 ++++++++++++++++++++ .../test/resources/mng-5527/relocations/pom.xml | 72 +++++++++++++++++++ .../its/mng5527/relocated1/bom/0/bom-0.pom | 48 +++++++++++++ .../its/mng5527/relocated2/bom/0/bom-0.pom | 48 +++++++++++++ .../its/mng5527/relocated3/bom/0/bom-0.pom | 39 +++++++++++ .../resources/mng-5527/settings-template.xml | 43 ++++++++++++ 7 files changed, 325 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/83b4b5b6/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java ---------------------------------------------------------------------- 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 9f1a36c..8f1477c 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 @@ -106,6 +106,7 @@ public class IntegrationTestSuite // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng5527DependencyManagementImportRelocationsTest.class ); suite.addTestSuite( MavenITmng4463DependencyManagementImportVersionRanges.class ); suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class ); suite.addTestSuite( MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.class ); http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/83b4b5b6/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5527DependencyManagementImportRelocationsTest.java ---------------------------------------------------------------------- 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 0000000..aac31d3 --- /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.5.1,)" ); + } + + 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" ) ); + + } + +} http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/83b4b5b6/core-it-suite/src/test/resources/mng-5527/relocations/pom.xml ---------------------------------------------------------------------- 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 0000000..822f1cf --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5527/relocations/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.its.mng5527</groupId> + <artifactId>0</artifactId> + <version>2016062</version> + <packaging>pom</packaging> + + <name>Maven Integration Test :: MNG-5527</name> + + <description> + Tests that dependency management import relocations are supported. + </description> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng5527.relocated1</groupId> + <artifactId>bom</artifactId> + <version>0</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.its.plugins</groupId> + <artifactId>maven-it-plugin-expression</artifactId> + <version>2.1-SNAPSHOT</version> + <executions> + <execution> + <phase>verify</phase> + <goals> + <goal>eval</goal> + </goals> + <configuration> + <expressions> + <expression>project/dependencyManagement</expression> + </expressions> + <outputFile>${project.build.directory}/project.properties</outputFile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/83b4b5b6/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated1/bom/0/bom-0.pom ---------------------------------------------------------------------- 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 0000000..9fd2234 --- /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 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.its.mng5527.relocated1</groupId> + <artifactId>bom</artifactId> + <version>0</version> + <packaging>pom</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>level1-group-id-must-not-be-imported</groupId> + <artifactId>level1-artifact-id-must-not-be-imported</artifactId> + <version>level1-version-must-not-be-imported</version> + </dependency> + </dependencies> + </dependencyManagement> + + <distributionManagement> + <relocation> + <groupId>org.apache.maven.its.mng5527.relocated2</groupId> + <artifactId>bom</artifactId> + <version>0</version> + <message>LEVEL_1</message> + </relocation> + </distributionManagement> +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/83b4b5b6/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated2/bom/0/bom-0.pom ---------------------------------------------------------------------- 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 0000000..cc5aa27 --- /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 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.its.mng5527.relocated2</groupId> + <artifactId>bom</artifactId> + <version>0</version> + <packaging>pom</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>level2-group-id-must-not-be-imported</groupId> + <artifactId>level2-artifact-id-must-not-be-imported</artifactId> + <version>level2-version-must-not-be-imported</version> + </dependency> + </dependencies> + </dependencyManagement> + + <distributionManagement> + <relocation> + <groupId>org.apache.maven.its.mng5527.relocated3</groupId> + <artifactId>bom</artifactId> + <version>0</version> + <message>LEVEL_2</message> + </relocation> + </distributionManagement> +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/83b4b5b6/core-it-suite/src/test/resources/mng-5527/repo/org/apache/maven/its/mng5527/relocated3/bom/0/bom-0.pom ---------------------------------------------------------------------- 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 0000000..35c729e --- /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 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.its.mng5527.relocated3</groupId> + <artifactId>bom</artifactId> + <version>0</version> + <packaging>pom</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>group-id-to-import</groupId> + <artifactId>artifact-id-to-import</artifactId> + <version>version-to-import</version> + </dependency> + </dependencies> + </dependencyManagement> +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/83b4b5b6/core-it-suite/src/test/resources/mng-5527/settings-template.xml ---------------------------------------------------------------------- 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 0000000..f22a7f3 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5527/settings-template.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> + +<settings> + <profiles> + <profile> + <id>maven-core-it-repo</id> + <repositories> + <repository> + <id>maven-core-it</id> + <url>@baseurl@/../repo</url> + <releases> + <checksumPolicy>ignore</checksumPolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + </profile> + </profiles> + <activeProfiles> + <activeProfile>maven-core-it-repo</activeProfile> + </activeProfiles> +</settings>