Skip to content

Commit 3faf445

Browse files
committed
Re-enable import into Eclipse IDE
The migration to Gradle 7.2 resulted in a regression for our Eclipse IDE support: several projects ended up with recursive classpath entries in their generated .classpath files which prevent those projects from being built within Eclipse. This commit addresses this issue with a solution that may well be a "hack". Nonetheless, a working hack is better than not being able to import into Eclipse at all. See gh-26870
1 parent 9e986c0 commit 3faf445

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

gradle/ide.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ eclipse.classpath.file.whenMerged { classpath ->
1818
if (matcher) {
1919
def projectName = matcher[0][1]
2020
def path = "/${projectName}"
21-
if(!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) {
22-
def dependency = new ProjectDependency(path)
23-
dependency.exported = true
24-
classpath.entries.add(dependency)
21+
if (!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) {
22+
// Avoid recursive dependency on current project.
23+
if (!entry.path.matches('.+/' + projectName + '/build/([^/]+/)+(?:main|test)')) {
24+
def dependency = new ProjectDependency(path)
25+
dependency.exported = true
26+
classpath.entries.add(dependency)
27+
}
2528
}
2629
classpath.entries.remove(entry)
2730
}

0 commit comments

Comments
 (0)