Skip to content

Commit

Permalink
Export maven.repo.local for gradle tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glefloch committed Jun 3, 2021
1 parent cc94f11 commit cf4032e
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,28 @@ void startGradleDaemon(boolean useWrapper) throws Exception {
} else {
gradle = ExecuteUtil.findExecutableFile("gradle");
}

CliDriver.Result result = CliDriver.executeArbitraryCommand(gradle.getAbsolutePath(), "--daemon", "-q",
List<String> args = Arrays.asList(gradle.getAbsolutePath(), "--daemon", "-q",
"--project-dir=" + project.toAbsolutePath());
String localMavenRepo = System.getProperty("maven.repo.local", null);
if (localMavenRepo != null) {
args.add("-Dmaven.repo.local=" + localMavenRepo);
}
CliDriver.Result result = CliDriver.executeArbitraryCommand(args.toArray(new String[0]));
Assertions.assertEquals(0, result.exitCode, "Gradle daemon should start properly");
}

@AfterEach
void stopGradleDaemon() throws Exception {
if (gradle != null) {
CliDriver.Result result = CliDriver.executeArbitraryCommand(gradle.getAbsolutePath(), "--stop",
List<String> args = Arrays.asList(gradle.getAbsolutePath(), "--stop",
"--project-dir=" + project.toAbsolutePath());

String localMavenRepo = System.getProperty("maven.repo.local", null);
if (localMavenRepo != null) {
args.add("-Dmaven.repo.local=" + localMavenRepo);
}

CliDriver.Result result = CliDriver.executeArbitraryCommand(args.toArray(new String[0]));
Assertions.assertEquals(0, result.exitCode, "Gradle daemon should stop properly");
}
}
Expand Down

0 comments on commit cf4032e

Please sign in to comment.