|
41 | 41 | import org.apache.maven.artifact.repository.DefaultArtifactRepository; |
42 | 42 | import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; |
43 | 43 | import org.apache.maven.artifact.versioning.VersionRange; |
| 44 | +import org.apache.maven.properties.internal.SystemProperties; |
44 | 45 | import org.apache.maven.settings.Settings; |
45 | | -import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader; |
| 46 | +import org.apache.maven.settings.building.DefaultSettingsBuilderFactory; |
| 47 | +import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; |
| 48 | +import org.apache.maven.settings.building.SettingsBuildingRequest; |
46 | 49 | import org.codehaus.plexus.testing.PlexusTest; |
47 | 50 | import org.codehaus.plexus.util.FileUtils; |
48 | | -import org.codehaus.plexus.util.ReaderFactory; |
49 | 51 | import org.codehaus.plexus.util.StringUtils; |
50 | 52 | import org.hamcrest.io.FileMatchers; |
51 | 53 | import org.junit.jupiter.api.BeforeEach; |
@@ -83,7 +85,13 @@ final void setUpLocalRepo() throws Exception { |
83 | 85 | if (localRepo == null) { |
84 | 86 | File settingsFile = new File(System.getProperty("user.home"), ".m2/settings.xml"); |
85 | 87 | if (settingsFile.exists()) { |
86 | | - Settings settings = new SettingsXpp3Reader().read(ReaderFactory.newXmlReader(settingsFile)); |
| 88 | + SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); |
| 89 | + request.setUserSettingsFile(settingsFile); |
| 90 | + request.setSystemProperties(SystemProperties.getSystemProperties()); |
| 91 | + Settings settings = new DefaultSettingsBuilderFactory() |
| 92 | + .newInstance() |
| 93 | + .build(request) |
| 94 | + .getEffectiveSettings(); |
87 | 95 | localRepo = settings.getLocalRepository(); |
88 | 96 | } |
89 | 97 | } |
@@ -116,7 +124,7 @@ protected List<String> getClasspath() throws Exception { |
116 | 124 | File file = getLocalArtifactPath("commons-lang", "commons-lang", "2.0", "jar"); |
117 | 125 |
|
118 | 126 | assertThat( |
119 | | - "test prerequisite: commons-lang library must be available in local repository, expected ", |
| 127 | + "test prerequisite: commons-lang library must be available in local repository at " + file, |
120 | 128 | file, |
121 | 129 | FileMatchers.aReadableFile()); |
122 | 130 |
|
|
0 commit comments