Skip to content

Commit

Permalink
Exclude the project itself becoming its project classpath entry
Browse files Browse the repository at this point in the history
Signed-off-by: Sheng Chen <[email protected]>
  • Loading branch information
jdneo committed Dec 20, 2023
1 parent 18354a0 commit 7e6fa80
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,16 @@ public void updateProjectDependencies(IProject project, IProgressMonitor monitor
}
IJavaProject javaProject = JavaCore.create(project);
List<IClasspathEntry> 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<IClasspathEntry> getProjectDependencyEntries(Set<BuildTargetIdentifier> projectDependencies) {
private List<IClasspathEntry> getProjectDependencyEntries(IProject project, Set<BuildTargetIdentifier> projectDependencies) {
List<IClasspathEntry> 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,
Expand Down

0 comments on commit 7e6fa80

Please sign in to comment.