diff --git a/gradle/ide.gradle b/gradle/ide.gradle index 6c112fd5b39e..20bf5f494e73 100644 --- a/gradle/ide.gradle +++ b/gradle/ide.gradle @@ -18,10 +18,13 @@ eclipse.classpath.file.whenMerged { classpath -> if (matcher) { def projectName = matcher[0][1] def path = "/${projectName}" - if(!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) { - def dependency = new ProjectDependency(path) - dependency.exported = true - classpath.entries.add(dependency) + if (!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) { + // Avoid recursive dependency on current project. + if (!entry.path.matches('.+/' + projectName + '/build/([^/]+/)+(?:main|test)')) { + def dependency = new ProjectDependency(path) + dependency.exported = true + classpath.entries.add(dependency) + } } classpath.entries.remove(entry) }