diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8181CentralRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8181CentralRepoTest.java new file mode 100644 index 0000000000..f061d3a5d1 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8181CentralRepoTest.java @@ -0,0 +1,57 @@ +/* + * 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. + */ +package org.apache.maven.it; + +import java.io.File; + +import org.apache.maven.shared.verifier.VerificationException; +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * This is a test set for MNG-8181. + */ +public class MavenITmng8181CentralRepoTest extends AbstractMavenIntegrationTestCase { + public MavenITmng8181CentralRepoTest() { + super("[4.0.0-beta-4,)"); + } + + /** + * Verify that the central url can be overridden by a user property. + * + * @throws Exception in case of failure + */ + @Test + public void testitModel() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8181-central-repo"); + + Verifier verifier = newVerifier(testDir.getAbsolutePath(), null); + verifier.setAutoclean(false); + verifier.addCliArgument("--install-settings=install-settings.xml"); + verifier.addCliArgument("--settings=settings.xml"); + verifier.addCliArgument("-Dmaven.repo.local=" + testDir.toPath().resolve("target/local-repo")); + verifier.addCliArgument("-Dmaven.repo.central=http://repo1.maven.org/"); + verifier.addCliArgument("validate"); + assertThrows(VerificationException.class, verifier::execute); + verifier.verifyTextInLog("central (http://repo1.maven.org/, default, releases)"); + } +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java index 45e97d647a..762140d5cd 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java @@ -120,6 +120,7 @@ public class TestSuiteOrdering implements ClassOrderer { * the tests are to finishing. Newer tests are also more likely to fail, so this is * a fail fast technique as well. */ + suite.addTestSuite(MavenITmng8181CentralRepoTest.class); suite.addTestSuite(MavenITmng8123BuildCacheTest.class); suite.addTestSuite(MavenITmng8106OverlappingDirectoryRolesTest.class); suite.addTestSuite(MavenITmng8005IdeWorkspaceReaderUsedTest.class); diff --git a/its/core-it-suite/src/test/resources/mng-8181-central-repo/install-settings.xml b/its/core-it-suite/src/test/resources/mng-8181-central-repo/install-settings.xml new file mode 100644 index 0000000000..05a46c8802 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-8181-central-repo/install-settings.xml @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + maven-default-http-blocker + external:http:* + Pseudo repository to mirror external repositories initially using HTTP. + http://0.0.0.0/ + true + + + + + + + central + Central Repository + ${maven.repo.central} + + false + + + + + + + + central + Central Repository + ${maven.repo.central} + + false + + + + + + + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-8181-central-repo/pom.xml b/its/core-it-suite/src/test/resources/mng-8181-central-repo/pom.xml new file mode 100644 index 0000000000..51913cb003 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-8181-central-repo/pom.xml @@ -0,0 +1,36 @@ + + + + 4.1.0 + + + org.apache + apache + 33 + + + org.apache.maven.its.it0043 + maven-it-it0043 + 1.0-SNAPSHOT + + Maven Integration Test :: it0043 + Test for repository inheritance - ensure using the same id overrides the defaults + + diff --git a/its/core-it-suite/src/test/resources/mng-8181-central-repo/settings.xml b/its/core-it-suite/src/test/resources/mng-8181-central-repo/settings.xml new file mode 100644 index 0000000000..8622705fae --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-8181-central-repo/settings.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file