This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch MNG-6772 in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
commit 2abc8e5afb676bce68294a39bb2df8e506cdc128 Author: Eddie Wiegers <egw...@mst.edu> AuthorDate: Thu Oct 3 14:28:11 2019 -0500 [MNG-6772] Prove Super POM central entry won't override --- .../org/apache/maven/it/IntegrationTestSuite.java | 1 + ...mng6772NestedImportScopeRepositoryOverride.java | 95 ++++++++++++++++++++++ .../pom-template.xml | 50 ++++++++++++ .../org/apache/maven/its/mng6772/a/0.1/a-0.1.pom | 41 ++++++++++ .../org/apache/maven/its/mng6772/b/0.1/b-0.1.pom | 39 +++++++++ .../its/mng6772/dependency/0.1/dependency-0.1.pom | 41 ++++++++++ .../settings-override.xml | 23 ++++++ .../mng-6772-override-in-project/pom-template.xml | 53 ++++++++++++ .../org/apache/maven/its/mng6772/a/0.1/a-0.1.pom | 41 ++++++++++ .../org/apache/maven/its/mng6772/b/0.1/b-0.1.pom | 39 +++++++++ .../settings-override.xml | 23 ++++++ 11 files changed, 446 insertions(+) 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 87b948e..17506b2 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 @@ -107,6 +107,7 @@ public class IntegrationTestSuite // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng6772NestedImportScopeRepositoryOverride.class ); suite.addTestSuite( MavenITmng5669ReadPomsOnce.class ); suite.addTestSuite( MavenITmng6071GetResourceWithCustomPom.class ); suite.addTestSuite( MavenITmng6759TransitiveDependencyRepositoriesTest.class ); diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6772NestedImportScopeRepositoryOverride.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6772NestedImportScopeRepositoryOverride.java new file mode 100644 index 0000000..d4c3718 --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6772NestedImportScopeRepositoryOverride.java @@ -0,0 +1,95 @@ +package org.apache.maven.it; + +import java.io.File; + +/* + * 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.util.ResourceExtractor; + +/** + * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6772">MNG-6772</a>: + * + * The test POM references an import scope POM, which also has a dependency on an import scope POM. + * + * Both import POMs can only be found in the repository defined in the test POM. + * It has a parent POM that defines the same repository with a different location. + * The test confirms that the dominant repository definition (child) wins while resolving the import POMs. + * + */ +public class MavenITmng6772NestedImportScopeRepositoryOverride + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng6772NestedImportScopeRepositoryOverride() + { + super( "(3.6.2,)" ); + } + + // This will test the behavior using ProjectModelResolver + public void testitInProject() + throws Exception + { + final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6772-override-in-project" ); + + final Verifier verifier = newVerifier( testDir.getAbsolutePath(), null ); + overrideGlobalSettings( testDir, verifier ); + verifier.deleteArtifacts( "org.apache.maven.its.mng6772" ); + + verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } + + // This will test the behavior using DefaultModelResolver + public void testitInDependency() + throws Exception + { + final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6772-override-in-dependency" ); + + final Verifier verifier = newVerifier( testDir.getAbsolutePath(), null ); + overrideGlobalSettings( testDir, verifier ); + verifier.deleteArtifacts( "org.apache.maven.its.mng6772" ); + + verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + + verifier.executeGoal( "compile" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } + + // central must not be defined in any settings.xml or super POM will never be in play. + private void overrideGlobalSettings( final File testDir, final Verifier verifier ) + { + final File settingsFile = new File( testDir, "settings-override.xml" ); + final String path = settingsFile.getAbsolutePath(); + verifier.getCliOptions().add( "--global-settings" ); + if ( path.indexOf( ' ' ) < 0 ) + { + verifier.getCliOptions().add( path ); + } + else + { + verifier.getCliOptions().add( '"' + path + '"' ); + } + } + +} diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-dependency/pom-template.xml b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/pom-template.xml new file mode 100644 index 0000000..9120768 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/pom-template.xml @@ -0,0 +1,50 @@ +<?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.mng6772</groupId> + <artifactId>test</artifactId> + <version>0.1</version> + <packaging>jar</packaging> + + <name>Maven Integration Test :: MNG-6772</name> + <description> + Checks that overriding the central repository always wins over the super POM. + </description> + + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng6772</groupId> + <artifactId>dependency</artifactId> + <version>0.1</version> + <type>pom</type> + </dependency> + </dependencies> + + <repositories> + <repository> + <id>central</id> + <url>@baseurl@/repo</url> + </repository> + </repositories> +</project> diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/a/0.1/a-0.1.pom b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/a/0.1/a-0.1.pom new file mode 100644 index 0000000..5420f7b --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/a/0.1/a-0.1.pom @@ -0,0 +1,41 @@ +<?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.mng6772</groupId> + <artifactId>a</artifactId> + <version>0.1</version> + <packaging>pom</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng6772</groupId> + <artifactId>b</artifactId> + <version>0.1</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/b/0.1/b-0.1.pom b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/b/0.1/b-0.1.pom new file mode 100644 index 0000000..5cc3486 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/b/0.1/b-0.1.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.mng6772</groupId> + <artifactId>b</artifactId> + <version>0.1</version> + <packaging>pom</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng6772</groupId> + <artifactId>c</artifactId> + <version>0.1</version> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/dependency/0.1/dependency-0.1.pom b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/dependency/0.1/dependency-0.1.pom new file mode 100644 index 0000000..5a6b1e1 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/repo/org/apache/maven/its/mng6772/dependency/0.1/dependency-0.1.pom @@ -0,0 +1,41 @@ +<?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.mng6772</groupId> + <artifactId>dependency</artifactId> + <version>0.1</version> + <packaging>pom</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng6772</groupId> + <artifactId>a</artifactId> + <version>0.1</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-dependency/settings-override.xml b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/settings-override.xml new file mode 100644 index 0000000..662d3f0 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-dependency/settings-override.xml @@ -0,0 +1,23 @@ +<?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> +</settings> diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-project/pom-template.xml b/core-it-suite/src/test/resources/mng-6772-override-in-project/pom-template.xml new file mode 100644 index 0000000..19149cd --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-project/pom-template.xml @@ -0,0 +1,53 @@ +<?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.mng6772</groupId> + <artifactId>test</artifactId> + <version>0.1</version> + <packaging>jar</packaging> + + <name>Maven Integration Test :: MNG-6772</name> + <description> + Checks that overriding the central repository always wins over the super POM. + </description> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng6772</groupId> + <artifactId>a</artifactId> + <version>0.1</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <repositories> + <repository> + <id>central</id> + <url>@baseurl@/repo</url> + </repository> + </repositories> +</project> diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-project/repo/org/apache/maven/its/mng6772/a/0.1/a-0.1.pom b/core-it-suite/src/test/resources/mng-6772-override-in-project/repo/org/apache/maven/its/mng6772/a/0.1/a-0.1.pom new file mode 100644 index 0000000..5420f7b --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-project/repo/org/apache/maven/its/mng6772/a/0.1/a-0.1.pom @@ -0,0 +1,41 @@ +<?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.mng6772</groupId> + <artifactId>a</artifactId> + <version>0.1</version> + <packaging>pom</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng6772</groupId> + <artifactId>b</artifactId> + <version>0.1</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-project/repo/org/apache/maven/its/mng6772/b/0.1/b-0.1.pom b/core-it-suite/src/test/resources/mng-6772-override-in-project/repo/org/apache/maven/its/mng6772/b/0.1/b-0.1.pom new file mode 100644 index 0000000..5cc3486 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-project/repo/org/apache/maven/its/mng6772/b/0.1/b-0.1.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.mng6772</groupId> + <artifactId>b</artifactId> + <version>0.1</version> + <packaging>pom</packaging> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven.its.mng6772</groupId> + <artifactId>c</artifactId> + <version>0.1</version> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/core-it-suite/src/test/resources/mng-6772-override-in-project/settings-override.xml b/core-it-suite/src/test/resources/mng-6772-override-in-project/settings-override.xml new file mode 100644 index 0000000..662d3f0 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6772-override-in-project/settings-override.xml @@ -0,0 +1,23 @@ +<?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> +</settings>