diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle index 74e98d0277d..02430dcba4b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle @@ -1,3 +1,7 @@ +import org.gradle.plugins.ide.eclipse.EclipsePlugin +import org.gradle.plugins.ide.eclipse.model.Classpath +import org.gradle.plugins.ide.eclipse.model.Library + plugins { id "java-gradle-plugin" id "maven-publish" @@ -138,3 +142,19 @@ artifacts { toolchain { maximumCompatibleJavaVersion = JavaLanguageVersion.of(20) } + +plugins.withType(EclipsePlugin) { + eclipse { + classpath.file { merger -> + merger.whenMerged { content -> + if (content instanceof Classpath) { + content.entries.each { entry -> + if (entry instanceof Library && (entry.path.contains("gradle-api-") || entry.path.contains("groovy-"))) { + entry.entryAttributes.remove("test") + } + } + } + } + } + } +}