From 33bab86289c719758668f7a7908badc31a93e8ab Mon Sep 17 00:00:00 2001 From: Guillaume Le Floch Date: Wed, 2 Jun 2021 22:44:23 +0200 Subject: [PATCH] Export maven.repo.local for gradle tests --- .../io/quarkus/cli/CliProjectGradleTest.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java index ba48b79778f18..8871b9a3dc317 100644 --- a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java +++ b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java @@ -3,6 +3,7 @@ import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -54,16 +55,36 @@ void startGradleDaemon(boolean useWrapper) throws Exception { gradle = ExecuteUtil.findExecutableFile("gradle"); } - CliDriver.Result result = CliDriver.executeArbitraryCommand(gradle.getAbsolutePath(), "--daemon", "-q", - "--project-dir=" + project.toAbsolutePath()); + List args = new ArrayList<>(); + args.add(gradle.getAbsolutePath()); + args.add("--daemon"); + args.add("-q"); + args.add("--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", - "--project-dir=" + project.toAbsolutePath()); + + List args = new ArrayList<>(); + args.add(gradle.getAbsolutePath()); + args.add("--stop"); + args.add("--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"); } }