From 7e6fa805c1d1d98bf92a381f736aa4b8c53b7e95 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Wed, 20 Dec 2023 14:33:07 +0800 Subject: [PATCH] Exclude the project itself becoming its project classpath entry Signed-off-by: Sheng Chen --- .../gradle/bs/importer/GradleBuildServerBuildSupport.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildServerBuildSupport.java b/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildServerBuildSupport.java index 714130636..eeee66743 100644 --- a/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildServerBuildSupport.java +++ b/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildServerBuildSupport.java @@ -290,16 +290,16 @@ public void updateProjectDependencies(IProject project, IProgressMonitor monitor } IJavaProject javaProject = JavaCore.create(project); List classpath = new LinkedList<>(Arrays.asList(javaProject.getRawClasspath())); - classpath.addAll(getProjectDependencyEntries(projectDependencies)); + classpath.addAll(getProjectDependencyEntries(project, projectDependencies)); javaProject.setRawClasspath(classpath.toArray(IClasspathEntry[]::new), javaProject.getOutputLocation(), monitor); } - private List getProjectDependencyEntries(Set projectDependencies) { + private List getProjectDependencyEntries(IProject project, Set projectDependencies) { List entries = new LinkedList<>(); for (BuildTargetIdentifier dependency : projectDependencies) { URI uri = Utils.getUriWithoutQuery(dependency.getUri()); IProject dependencyProject = ProjectUtils.getProjectFromUri(uri.toString()); - if (dependencyProject != null) { + if (dependencyProject != null && !Objects.equals(project, dependencyProject)) { entries.add(JavaCore.newProjectEntry( dependencyProject.getFullPath(), ClasspathEntry.NO_ACCESS_RULES,