From 1e97b2137b1addb44ec9e58779c2a406f132abf7 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 28 May 2024 15:58:02 +0200 Subject: [PATCH] Disable class data sharing (CDS) for tests Prior to this commit, the Gradle build output the following warning multiple times. OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended Since we don't need CDS enabled for our tests, I've added `-Xshare:off` as a JVM argument for our tests to disable CDS. (cherry picked from commit 27985b1439950106454da11a0a06c6b131938af9) --- .../java/org/springframework/build/TestConventions.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/build/TestConventions.java b/buildSrc/src/main/java/org/springframework/build/TestConventions.java index 8c945825f7..1283d23376 100644 --- a/buildSrc/src/main/java/org/springframework/build/TestConventions.java +++ b/buildSrc/src/main/java/org/springframework/build/TestConventions.java @@ -62,8 +62,11 @@ class TestConventions { if (project.hasProperty("testGroups")) { test.systemProperty("testGroups", project.getProperties().get("testGroups")); } - test.jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED", - "--add-opens=java.base/java.util=ALL-UNNAMED"); + test.jvmArgs( + "--add-opens=java.base/java.lang=ALL-UNNAMED", + "--add-opens=java.base/java.util=ALL-UNNAMED", + "-Xshare:off" + ); } private void configureTestRetryPlugin(Project project, Test test) {