mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Work around bug in Gradle's Eclipse model
The model incorrectly marks the Gradle API and all of its dependencies as test dependencies, making them unavailable in Eclipse to code in src/main/java. We work around this by modifying the classpath container to remove the test attribute from the dependencies that should be available to main code. See gh-41228
This commit is contained in:
parent
3e98a932e0
commit
d2f74426f7
|
@ -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"
|
||||
|
@ -219,3 +223,19 @@ publishing {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user