Skip to content

Commit 48ded12

Browse files
committed
We now use the default local maven repository.
1 parent beb99af commit 48ded12

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenIntegrationHarness.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public class MavenIntegrationHarness extends ResourceHarness {
5353
*/
5454
private static final String SPOTLESS_MAVEN_VERSION_IDE = null;
5555

56-
private static final String LOCAL_MAVEN_REPOSITORY_DIR = "localMavenRepositoryDir";
5756
private static final String SPOTLESS_MAVEN_PLUGIN_VERSION = "spotlessMavenPluginVersion";
5857
private static final String CONFIGURATION = "configuration";
5958
private static final String EXECUTIONS = "executions";
@@ -179,8 +178,7 @@ protected void writePom(String[] executions, String[] configuration, String[] de
179178

180179
protected MavenRunner mavenRunner() throws IOException {
181180
return MavenRunner.create()
182-
.withProjectDir(rootFolder())
183-
.withLocalRepository(new File(getSystemProperty(LOCAL_MAVEN_REPOSITORY_DIR)));
181+
.withProjectDir(rootFolder());
184182
}
185183

186184
/**
@@ -247,8 +245,6 @@ private static String getSystemProperty(String name) {
247245
if (SPOTLESS_MAVEN_VERSION_IDE != null) {
248246
if (name.equals("spotlessMavenPluginVersion")) {
249247
return SPOTLESS_MAVEN_VERSION_IDE;
250-
} else if (name.equals("localMavenRepositoryDir")) {
251-
return new File("build/localMavenRepository").getAbsolutePath();
252248
} else {
253249
throw Unhandled.stringException(name);
254250
}

plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenRunner.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2023 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,6 @@ private MavenRunner() {}
4646

4747
private File projectDir;
4848
private String[] args;
49-
private File localRepositoryDir;
5049
private Map<String, String> environment = new HashMap<>();
5150

5251
public MavenRunner withProjectDir(File projectDir) {
@@ -59,11 +58,6 @@ public MavenRunner withArguments(String... args) {
5958
return this;
6059
}
6160

62-
public MavenRunner withLocalRepository(File localRepositoryDir) {
63-
this.localRepositoryDir = localRepositoryDir;
64-
return this;
65-
}
66-
6761
public MavenRunner withRemoteDebug(int port) {
6862
String address = (Jvm.version() < 9 ? "" : "*:") + port;
6963
environment.put("MAVEN_OPTS", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=" + address);
@@ -75,7 +69,7 @@ private Result run() throws IOException, InterruptedException {
7569
Objects.requireNonNull(args, "Need to call withArguments() first");
7670
// run maven with the given args in the given directory
7771
String argsString = String.join(" ", Arrays.asList(args));
78-
List<String> cmds = getPlatformCmds("-e -Dmaven.repo.local=" + localRepositoryDir + ' ' + argsString);
72+
List<String> cmds = getPlatformCmds("-e " + argsString);
7973
ProcessBuilder builder = new ProcessBuilder(cmds);
8074
builder.directory(projectDir);
8175
builder.environment().putAll(environment);

0 commit comments

Comments
 (0)