Skip to content

Commit 578fadf

Browse files
author
Dave Syer
committed
Attempt to allow Aether to load from local repo
1 parent e46c427 commit 578fadf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,24 @@ private File getM2HomeDirectory() {
114114
if (StringUtils.hasLength(grapeRoot)) {
115115
return new File(grapeRoot);
116116
}
117+
return getDefaultM2HomeDirectory();
118+
}
119+
120+
private File getDefaultM2HomeDirectory() {
121+
String mavenRoot = System.getProperty("maven.home");
122+
if (StringUtils.hasLength(mavenRoot)) {
123+
return new File(mavenRoot);
124+
}
117125
return new File(System.getProperty("user.home"), ".m2");
118126
}
119127

120128
private Set<RemoteRepository> getRemoteRepositories() {
121129
LinkedHashSet<RemoteRepository> repositories = new LinkedHashSet<RemoteRepository>();
130+
String grapeRoot = System.getProperty("grape.root");
131+
if (StringUtils.hasLength(grapeRoot)) {
132+
addRemoteRepository(repositories, "local", new File(
133+
getDefaultM2HomeDirectory(), "repository").toURI().toASCIIString());
134+
}
122135
addRemoteRepository(repositories, "central", "http://repo1.maven.org/maven2/");
123136
return repositories;
124137
}

0 commit comments

Comments
 (0)