diff --git a/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusProdModeTest.java b/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusProdModeTest.java index f9c2110ceb1e4..f090691b62a58 100644 --- a/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusProdModeTest.java +++ b/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusProdModeTest.java @@ -392,7 +392,12 @@ public void close() throws Throwable { Class testClass = extensionContext.getRequiredTestClass(); try { - outputDir = Files.createTempDirectory("quarkus-prod-mode-test"); + Optional projectBuildDir = Optional.ofNullable(System.getProperty("project.build.directory")) //maven + .or(() -> Optional.ofNullable(System.getProperty("buildDir"))) //gradle + .map(Path::of); + + outputDir = projectBuildDir.isPresent() ? Files.createTempDirectory(projectBuildDir.get(), "quarkus-prod-mode-test") + : Files.createTempDirectory("quarkus-prod-mode-test"); Path deploymentDir = outputDir.resolve("deployment-result"); buildDir = outputDir.resolve("build-result");