From 5e4e530c59812c7d8d2b4d2ba292861dc9cecec5 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:02:43 +0300 Subject: [PATCH 1/2] Remove Java 21 classpath entries in Eclipse projects Since the me.champeau.mrjar stores Java 21 main and test sources in non-standard locations, and since we can only use a single JDK within Eclipse, this commit updates `ide.gradle` to remove `java21` classpath entries in Eclipse projects. --- gradle/ide.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gradle/ide.gradle b/gradle/ide.gradle index 517e4af6c20..fbfa2c804b9 100644 --- a/gradle/ide.gradle +++ b/gradle/ide.gradle @@ -69,6 +69,13 @@ eclipse.classpath.file.whenMerged { } } +// Remove Java 21 classpath entries, since we currently use Java 17 +// within Eclipse. Consequently, Java 21 features managed via the +// me.champeau.mrjar plugin cannot be built or tested within Eclipse. +eclipse.classpath.file.whenMerged { classpath -> + classpath.entries.removeAll { it.path =~ /src\/(main|test)\/java21/ } +} + // Remove classpath entries for non-existent libraries added by the me.champeau.mrjar // plugin, such as "spring-core/build/classes/kotlin/java21". eclipse.classpath.file.whenMerged { 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 2/2] 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 8c945825f73..1283d233765 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) {