@@ -102,19 +102,18 @@ public class PrivateArtifactRepositoryTest {
102
102
.withEnv ("REPOSILITE_OPTS" , "--token user:secret --shared-config shared.configuration.json" );
103
103
104
104
public static final String DEPENDENCY_CLASS_FQNAME = "com.example.dependency.DependencyClass" ;
105
- private static final File LOCAL_MAVEN_REPOSITORY = Path .of (TESTCODE_DIR + "/user.home/.m2/repository" ).toFile ();
106
- private static final Path DEPENDENCY_PATH_IN_LOCAL_MAVEN_REPO = Path .of (TESTCODE_DIR + "/user.home/.m2/repository/com/example/dependency/dependency-project" );
105
+ private static final String NEW_USER_HOME = Path .of ("." ).resolve (TESTCODE_DIR + "/user.home" ).toAbsolutePath ().normalize ().toString ();
106
+ private static final Path DEPENDENCY_PATH_IN_LOCAL_MAVEN_REPO = Path .of (NEW_USER_HOME + "/.m2/repository/com/example/dependency/dependency-project" ).toAbsolutePath ().normalize ();
107
+ private static final File LOCAL_MAVEN_REPOSITORY = Path .of (NEW_USER_HOME + "/.m2/repository" ).toFile ();
107
108
private static MavenRepository originalMavenRepository ;
108
109
private static String originalUserHome ;
109
- private static String newUserHome ;
110
110
@ Autowired
111
111
private RewriteProjectParser parser ;
112
112
113
113
@ BeforeAll
114
114
static void beforeAll (@ TempDir Path tempDir ) {
115
115
originalUserHome = System .getProperty ("user.home" );
116
- newUserHome = Path .of ("." ).resolve (TESTCODE_DIR + "/user.home" ).toAbsolutePath ().normalize ().toString ();
117
- System .setProperty ("user.home" , newUserHome );
116
+ System .setProperty ("user.home" , NEW_USER_HOME );
118
117
originalMavenRepository = MavenRepository .MAVEN_LOCAL_DEFAULT ;
119
118
// overwrites MavenRepository.MAVEN_LOCAL_DEFAULT which is statically initialized and used previous value of
120
119
// 'user.home'. This constant is used elsewhere to retrieve the default local Maven repo URI.
@@ -200,8 +199,8 @@ private static void renderTemplates(Integer port) throws IOException {
200
199
Path dependentPomPath = renderPomXml (port , dependentPomTmplPath );
201
200
202
201
// adjust path in settings.xml
203
- Path settingsXmlTmplPath = Path .of ("./" ).resolve (newUserHome + "/.m2/settings.xml.template" ).toAbsolutePath ().normalize ();
204
- renderSettingsXml (newUserHome , settingsXmlTmplPath );
202
+ Path settingsXmlTmplPath = Path .of ("./" ).resolve (NEW_USER_HOME + "/.m2/settings.xml.template" ).toAbsolutePath ().normalize ();
203
+ renderSettingsXml (NEW_USER_HOME , settingsXmlTmplPath );
205
204
}
206
205
207
206
private static Path renderSettingsXml (String testcodeDir , Path settingsXmlTmplPath ) throws IOException {
0 commit comments