[MNG-6079] 3.4 regression: cannot override version of a dependencyManagement in a submodule any more
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/88c15286 Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/88c15286 Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/88c15286 Branch: refs/heads/DEPMGMT-INCLUDE Commit: 88c15286d043a54820fce54b18333e75311ec0a2 Parents: e941f84 Author: Christian Schulte <schu...@apache.org> Authored: Sat Aug 13 02:04:02 2016 +0200 Committer: Christian Schulte <schu...@apache.org> Committed: Thu Feb 2 04:17:34 2017 +0100 ---------------------------------------------------------------------- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...ndencyManagementImportInterpolationTest.java | 81 ++++++++++++++++++++ .../src/test/resources/mng-6079/parent-pom.xml | 49 ++++++++++++ .../src/test/resources/mng-6079/pom.xml | 69 +++++++++++++++++ .../resources/mng-6079/settings-template.xml | 43 +++++++++++ 5 files changed, 243 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/88c15286/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 2e0799c..9cba111 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( MavenITmng6079DependencyManagementImportInterpolationTest.class ); suite.addTestSuite( MavenITmng5971HierarchicalImportScopeTest.class ); suite.addTestSuite( MavenITmng5600DependencyManagementImportExclusionsTest.class ); suite.addTestSuite( MavenITmng5527DependencyManagementImportRelocationsTest.class ); http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/88c15286/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6079DependencyManagementImportInterpolationTest.java ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6079DependencyManagementImportInterpolationTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6079DependencyManagementImportInterpolationTest.java new file mode 100644 index 0000000..21ca3e4 --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6079DependencyManagementImportInterpolationTest.java @@ -0,0 +1,81 @@ +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.List; +import java.util.Map; + +import org.apache.maven.it.util.ResourceExtractor; + +import static junit.framework.Assert.assertTrue; + +/** + * [MNG-6079] 3.4 regression: cannot override version of a dependencyManagement in a submodule any more + * + * @author Christian Schulte + */ +public class MavenITmng6079DependencyManagementImportInterpolationTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng6079DependencyManagementImportInterpolationTest() + { + super( "[2.0.9,)" ); + } + + public void testInheritanceProcessing() + throws Exception + { + final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6079" ); + + final Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + 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(); + + final List<String> dependencies0 = verifier.loadLines( "target/compile.txt", "UTF-8" ); + assertTrue( contains( dependencies0, "org.apache.maven.surefire:surefire-api:jar:2.12" ) ); + } + + private static boolean contains( final List<String> lines, final String pattern ) + { + for ( int i = 0, l0 = lines.size(); i < l0; i++ ) + { + if ( lines.get( i ).contains( pattern ) ) + { + return true; + } + } + + return false; + } + +} http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/88c15286/core-it-suite/src/test/resources/mng-6079/parent-pom.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6079/parent-pom.xml b/core-it-suite/src/test/resources/mng-6079/parent-pom.xml new file mode 100644 index 0000000..86cdcec --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6079/parent-pom.xml @@ -0,0 +1,49 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.its.mng6079</groupId> + <artifactId>parent</artifactId> + <packaging>pom</packaging> + <version>1.0-SNAPSHOT</version> + + <properties> + <surefire.version>2.10</surefire.version> + </properties> + + <!-- Import dependencies from surefire, especially surefire-api --> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire</artifactId> + <version>${surefire.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/88c15286/core-it-suite/src/test/resources/mng-6079/pom.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6079/pom.xml b/core-it-suite/src/test/resources/mng-6079/pom.xml new file mode 100644 index 0000000..bc2e24d --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6079/pom.xml @@ -0,0 +1,69 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <parent> + <groupId>org.apache.maven.its.mng6079</groupId> + <artifactId>parent</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>parent-pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + <artifactId>submodule</artifactId> + + <properties> + <surefire.version>2.12</surefire.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-api</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.its.plugins</groupId> + <artifactId>maven-it-plugin-dependency-resolution</artifactId> + <version>2.1-SNAPSHOT</version> + <configuration> + <compileArtifacts>target/compile.txt</compileArtifacts> + </configuration> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/88c15286/core-it-suite/src/test/resources/mng-6079/settings-template.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6079/settings-template.xml b/core-it-suite/src/test/resources/mng-6079/settings-template.xml new file mode 100644 index 0000000..f22a7f3 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6079/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>