From e23588046a888b3631955106ad334300dde7ceb5 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 8 Aug 2024 16:48:47 -0700 Subject: [PATCH] Pass allow security manager flag in gradle test policy setup plugin (#111725) The `java.security.manager=allow` system property is required when running tests on newer Java versions with the security manager deprecated. As such, it should be set in our `GradleTestPolicySetupPlugin` so that it's done for external plugin authors. --- .../elasticsearch/gradle/test/GradleTestPolicySetupPlugin.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build-tools/src/main/java/org/elasticsearch/gradle/test/GradleTestPolicySetupPlugin.java b/build-tools/src/main/java/org/elasticsearch/gradle/test/GradleTestPolicySetupPlugin.java index a1da860abe26a..9593a281686e7 100644 --- a/build-tools/src/main/java/org/elasticsearch/gradle/test/GradleTestPolicySetupPlugin.java +++ b/build-tools/src/main/java/org/elasticsearch/gradle/test/GradleTestPolicySetupPlugin.java @@ -22,6 +22,9 @@ public void apply(Project project) { test.systemProperty("tests.gradle", true); test.systemProperty("tests.task", test.getPath()); + // Flag is required for later Java versions since our tests use a custom security manager + test.jvmArgs("-Djava.security.manager=allow"); + SystemPropertyCommandLineArgumentProvider nonInputProperties = new SystemPropertyCommandLineArgumentProvider(); // don't track these as inputs since they contain absolute paths and break cache relocatability nonInputProperties.systemProperty("gradle.dist.lib", gradle.getGradleHomeDir().getAbsolutePath() + "/lib");