Fix Eclipse support in Gradle build
The upgrade to Gradle 4.0 broke the custom Eclipse support in the Spring Framework build. This commit includes the following changes which re-enable support for Eclipse in the build. - Switched to ProjectDependency(String) constructor - Updated regular expression that matches against project output dependencies to include more than one subdirectory between "build" and "main"|"test". Issue: SPR-15862
This commit is contained in:
parent
397fd24849
commit
1cb96f47c8
|
|
@ -13,7 +13,7 @@ eclipse.jdt {
|
||||||
// Replace classpath entries with project dependencies (GRADLE-1116)
|
// Replace classpath entries with project dependencies (GRADLE-1116)
|
||||||
// http://issues.gradle.org/browse/GRADLE-1116
|
// http://issues.gradle.org/browse/GRADLE-1116
|
||||||
eclipse.classpath.file.whenMerged { classpath ->
|
eclipse.classpath.file.whenMerged { classpath ->
|
||||||
def regexp = /.*?\/([^\/]+)\/build\/[^\/]+\/(?:main|test)/ // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb)
|
def regexp = /.*?\/([^\/]+)\/build\/([^\/]+\/)+(?:main|test)/ // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb)
|
||||||
def projectOutputDependencies = classpath.entries.findAll { entry -> entry.path =~ regexp }
|
def projectOutputDependencies = classpath.entries.findAll { entry -> entry.path =~ regexp }
|
||||||
projectOutputDependencies.each { entry ->
|
projectOutputDependencies.each { entry ->
|
||||||
def matcher = (entry.path =~ regexp)
|
def matcher = (entry.path =~ regexp)
|
||||||
|
|
@ -21,7 +21,7 @@ eclipse.classpath.file.whenMerged { classpath ->
|
||||||
def projectName = matcher[0][1]
|
def projectName = matcher[0][1]
|
||||||
def path = "/${projectName}"
|
def path = "/${projectName}"
|
||||||
if(!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) {
|
if(!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) {
|
||||||
def dependency = new ProjectDependency(path, project(":${projectName}").path)
|
def dependency = new ProjectDependency(path)
|
||||||
dependency.exported = true
|
dependency.exported = true
|
||||||
classpath.entries.add(dependency)
|
classpath.entries.add(dependency)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue