From 5bd1ac20e703524dbec09c16da1b6c8e0edd98f5 Mon Sep 17 00:00:00 2001 From: Pranav Reddy Date: Fri, 11 Apr 2025 16:40:42 +0530 Subject: [PATCH] Fix build due to phasing off SecurityManager usage in favor of Java Agent Signed-off-by: Pranav Reddy --- build.gradle | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/build.gradle b/build.gradle index b3f01bff8d1..e22ba8de30e 100644 --- a/build.gradle +++ b/build.gradle @@ -148,6 +148,29 @@ allprojects { resolutionStrategy.force 'commons-io:commons-io:2.15.0' resolutionStrategy.force 'org.yaml:snakeyaml:2.2' } + + configurations { + agent + } + + dependencies { + } + + task prepareAgent(type: Copy) { + from(configurations.agent) + into "$buildDir/agent" + } + + dependencies { + agent "org.opensearch:opensearch-agent-bootstrap:${opensearch_version}" + agent "org.opensearch:opensearch-agent:${opensearch_version}" + agent "net.bytebuddy:byte-buddy:${versions.bytebuddy}" + } + + tasks.withType(Test) { + dependsOn prepareAgent + jvmArgs += ["-javaagent:" + project.layout.buildDirectory.file("agent/opensearch-agent-${opensearch_version}.jar").get()] + } } subprojects {