Skip to content

Commit f6387b0

Browse files
author
Dave Syer
committed
Use maven.home if it exists
1 parent 42c0848 commit f6387b0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

launcher/src/main/java/org/springframework/boot/loader/thin/MavenSettingsReader.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public MavenSettingsReader(String dir) {
6565
homeDir = new File(homeDir).getParent();
6666
}
6767
}
68-
if (homeDir==null || !new File(homeDir, "settings.xml").exists()) {
68+
if (homeDir == null || !new File(homeDir, "settings.xml").exists()) {
6969
if (homeDir == null) {
7070
homeDir = System.getProperty("maven.repo.local");
7171
if (homeDir != null) {
@@ -74,11 +74,14 @@ public MavenSettingsReader(String dir) {
7474
homeDir = null;
7575
}
7676
}
77-
}
78-
if (homeDir == null) {
79-
homeDir = System.getProperty("user.home");
80-
if (homeDir != null) {
81-
homeDir = new File(homeDir, ".m2").getAbsolutePath();
77+
}
78+
if (homeDir == null) {
79+
homeDir = System.getProperty("maven.home");
80+
if (homeDir == null || !new File(homeDir, "settings.xml").exists()) {
81+
homeDir = System.getProperty("user.home");
82+
if (homeDir != null) {
83+
homeDir = new File(homeDir, ".m2").getAbsolutePath();
84+
}
8285
}
8386
}
8487
}

0 commit comments

Comments
 (0)