Skip to content

Commit 98916be

Browse files
committed
[MNG-8311] Add IT for local repository in settings.xml
1 parent 444d7dd commit 98916be

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.maven.it;
20+
21+
import java.io.File;
22+
23+
import org.apache.maven.shared.verifier.Verifier;
24+
import org.apache.maven.shared.verifier.util.ResourceExtractor;
25+
import org.junit.jupiter.api.Test;
26+
27+
/**
28+
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-8311">MNG-8311</a>.
29+
*/
30+
class MavenITmng8311EmptyLocalRepositoryTest extends AbstractMavenIntegrationTestCase {
31+
32+
MavenITmng8311EmptyLocalRepositoryTest() {
33+
super("[4.0.0-beta-5,)");
34+
}
35+
36+
/**
37+
* Ensure that setting an empty {@code <localRepository>} in the settings.xml results the default local repository being used.
38+
*/
39+
@Test
40+
void testitemptyLocalRepository() throws Exception {
41+
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8311-empty-local-repository");
42+
43+
Verifier verifier = newVerifier(new File(testDir, "empty-repository").getAbsolutePath());
44+
verifier.addCliArguments("--settings", new File(testDir, "settings.xml").toString(), "-X", "validate");
45+
verifier.execute();
46+
verifier.verifyTextInLog("Using local repository at " + System.getProperty("user.home") + "/.m2/repository");
47+
}
48+
}

core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public TestSuiteOrdering() {
120120
* the tests are to finishing. Newer tests are also more likely to fail, so this is
121121
* a fail fast technique as well.
122122
*/
123+
suite.addTestSuite(MavenITmng8311EmptyLocalRepositoryTest.class);
123124
suite.addTestSuite(MavenITmng7982DependencyManagementTransitivityTest.class);
124125
suite.addTestSuite(MavenITmng8294ParentChecksTest.class);
125126
suite.addTestSuite(MavenITmng8293BomImportFromReactor.class);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.1.0" root="true">
3+
<groupId>org.apache.maven.its.mng8311</groupId>
4+
<artifactId>empty-repo</artifactId>
5+
<version>0.1-SNAPSHOT</version>
6+
<packaging>pom</packaging>
7+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
3+
<localRepository/>
4+
<interactiveMode/>
5+
<offline/>
6+
<pluginGroups/>
7+
<servers/>
8+
<mirrors/>
9+
<proxies/>
10+
<profiles/>
11+
<activeProfiles/>
12+
</settings>

0 commit comments

Comments
 (0)