From cf4032e6bf799a742ea020d929a907a50cbf27dd 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 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 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 ba48b79778f188..6fe3511a0bc41c 100644 --- a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java +++ b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java @@ -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 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 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"); } }