Browse Source

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
pull/1503/head
Sam Brannen 7 years ago
parent
commit
1cb96f47c8
  1. 4
      gradle/ide.gradle

4
gradle/ide.gradle

@ -13,7 +13,7 @@ eclipse.jdt { @@ -13,7 +13,7 @@ eclipse.jdt {
// Replace classpath entries with project dependencies (GRADLE-1116)
// http://issues.gradle.org/browse/GRADLE-1116
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 }
projectOutputDependencies.each { entry ->
def matcher = (entry.path =~ regexp)
@ -21,7 +21,7 @@ eclipse.classpath.file.whenMerged { classpath -> @@ -21,7 +21,7 @@ eclipse.classpath.file.whenMerged { classpath ->
def projectName = matcher[0][1]
def path = "/${projectName}"
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
classpath.entries.add(dependency)
}

Loading…
Cancel
Save