mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-06 23:19:03 +00:00
Exclude multi-release outputs from Eclipse classpath
Although the multi-release source sets in spring-core were already excluded from the Eclipse classpath, their Gradle output directories (such as build/classes/java/java21) were still added as libraries once they existed, resulting in duplicate types on the classpath. This commit removes those entries as well, generalizes the exclusion to any Java release version, revises the outdated comment in ide.gradle, and documents the limitation in the Eclipse import instructions. See gh-37397
This commit is contained in:
+7
-5
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user