This page documents the Eclipse IDE integration in the Spring Boot repository, which consists of build-time conventions to configure project metadata and workspace provisioning for contributors.
The EclipseConventions class applies Eclipse-specific build conventions when the Gradle EclipsePlugin is detected. It addresses integration challenges such as synchronizing settings files (.settings/) with Gradle configuration, configuring Java Development Tools (JDT) with the correct Java versions, and cleaning up classpath entries contributed by other plugins.
Integration Flow
Sources: buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java39-61 buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java94-100
Eclipse uses the .settings/ directory to store project-specific preferences. Since Gradle's Buildship plugin can overwrite these, EclipseConventions registers synchronization tasks to ensure critical settings are preserved.
Sources: buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java63-83 buildSrc/src/main/java/org/springframework/boot/build/EclipseSynchronizeJdtSettings.java50-52 buildSrc/src/main/java/org/springframework/boot/build/EclipseSynchronizeResourceSettings.java50-52
This task ensures UTF-8 encoding is configured for all projects. It extends PropertiesGeneratorTask and writes encoding/<project>=UTF-8 to the resource preferences file buildSrc/src/main/java/org/springframework/boot/build/EclipseSynchronizeResourceSettings.java51
Sources: buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java63-72 buildSrc/src/main/java/org/springframework/boot/build/EclipseSynchronizeResourceSettings.java32-56
This task configures JDT compiler settings to use the --release flag, ensuring Eclipse uses the same cross-compilation behavior as Gradle. It writes org.eclipse.jdt.core.compiler.release=true to the JDT preferences file buildSrc/src/main/java/org/springframework/boot/build/EclipseSynchronizeJdtSettings.java51
Sources: buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java74-83 buildSrc/src/main/java/org/springframework/boot/build/EclipseSynchronizeJdtSettings.java32-56
The JDT configuration sets Java compatibility levels and runtime names. While the build uses the latest JDK, the runtime target for modules is standardized.
| Configuration Point | Value / Logic | Source |
|---|---|---|
| Source Compatibility | JavaConventions.RUNTIME_JAVA_VERSION (17) | buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java86 |
| Target Compatibility | JavaConventions.RUNTIME_JAVA_VERSION (17) | buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java87 |
| JDT Java Runtime Name | JavaSE- + SystemRequirements.getJava().getVersion() | buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java106 |
| Classpath Cleanup | Removes entries matching /main and /build/classes/ or /build/resources/ if they are marked as test. | buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java110-122 |
The configureClasspathFile method uses an XmlFileContentMerger to remove Kotlin-plugin contributed build directories from the Eclipse classpath if they interfere with the IDE's internal build mechanism buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java94-100
Sources: buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java85-124
The Spring Boot project includes an Eclipse Oomph setup file (typically located at eclipse/spring-boot-project.setup) to automate the provisioning of a fully configured development environment.
The Oomph setup file handles the following:
Buildship (Gradle integration) and Spring JavaFormat.core, modules, starters) based on the project layout defined in settings.gradle.The eclipse/eclipse.properties file defines shared properties used during the integration process, such as the copyright year eclipse/eclipse.properties1
The build system includes utilities to transform repository definitions for various IDEs and build tools. RepositoryTransformersExtension provides a transformer for Ant-style repository declarations buildSrc/src/main/java/org/springframework/boot/build/RepositoryTransformersExtension.java53-55
It also handles credential injection for commercial repositories by looking for markers like {spring.mavenCredentials} and replacing them with environment-variable-backed XML fragments buildSrc/src/main/java/org/springframework/boot/build/RepositoryTransformersExtension.java65-77
Sources: buildSrc/src/main/java/org/springframework/boot/build/RepositoryTransformersExtension.java40-79 buildSrc/SpringRepositorySupport.groovy67-164
Refresh this wiki