diff --git a/buildSrc/src/testFixtures/java/org/elasticsearch/gradle/test/GradleIntegrationTestCase.java b/buildSrc/src/testFixtures/java/org/elasticsearch/gradle/test/GradleIntegrationTestCase.java index 0b57e65388049..5a04f3e85cb3a 100644 --- a/buildSrc/src/testFixtures/java/org/elasticsearch/gradle/test/GradleIntegrationTestCase.java +++ b/buildSrc/src/testFixtures/java/org/elasticsearch/gradle/test/GradleIntegrationTestCase.java @@ -10,6 +10,7 @@ import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; +import java.lang.management.ManagementFactory; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; @@ -43,7 +44,11 @@ protected GradleRunner getGradleRunner(String sampleProject) { } catch (IOException e) { throw new UncheckedIOException(e); } - return GradleRunner.create().withProjectDir(getProjectDir(sampleProject)).withPluginClasspath().withTestKitDir(testkit); + return GradleRunner.create() + .withProjectDir(getProjectDir(sampleProject)) + .withPluginClasspath() + .withTestKitDir(testkit) + .withDebug(ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0); } protected File getBuildDir(String name) {