diff --git a/gradle/ide.gradle b/gradle/ide.gradle index a6d561e76b3..c39673c3a84 100644 --- a/gradle/ide.gradle +++ b/gradle/ide.gradle @@ -68,14 +68,16 @@ 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. +// Remove classpath entries for multi-release source sets (such as "src/main/java21") +// and their Gradle output (such as "build/classes/java/java21"), since an Eclipse +// project supports only a single Java compliance level. Consequently, features +// managed via the multiReleaseJar plugin cannot be built or tested within Eclipse. eclipse.classpath.file.whenMerged { classpath -> - classpath.entries.removeAll { it.path =~ /src\/(main|test)\/java(21|24)/ } + classpath.entries.removeAll { it.path =~ /src\/(main|test)\/java\d+/ } + classpath.entries.removeAll { it.path =~ /build\/classes\/[^\/]+\/java\d+(Test)?$/ } } -// Remove classpath entries for non-existent libraries added by the me.champeau.mrjar +// Remove classpath entries for non-existent libraries added by the multiReleaseJar // plugin, such as "spring-core/build/classes/kotlin/java21". eclipse.classpath.file.whenMerged { entries.findAll { it instanceof Library && !file(it.path).exists() }.each { diff --git a/import-into-eclipse.md b/import-into-eclipse.md index 65f6bf7351f..b486406c945 100644 --- a/import-into-eclipse.md +++ b/import-into-eclipse.md @@ -53,6 +53,11 @@ within your locally cloned `spring-framework` working directory._ compile `spring-core` and generate JAXB types for `spring-oxm`. 1. `spring-aspects` does not compile due to references to aspect types unknown to Eclipse. - If you installed _AJDT_ into Eclipse it should work. +1. The Java 21 and Java 24 multi-release sources in `spring-core` (`src/main/java21`, + `src/main/java24`, and `src/test/java21`) are not configured as source folders in + Eclipse, since an Eclipse project supports only a single Java compliance level. + - Use `./gradlew :spring-core:java21Test` or `./gradlew :spring-core:java24Test` to + build and test those sources from the command line. 1. While JUnit tests pass from the command line with Gradle, some may fail when run from the IDE. - Resolving this is a work in progress.