Skip to content

Commit

Permalink
Maven projects aren't cached when populated in Workspace Reader
Browse files Browse the repository at this point in the history
ResolveArtifactsAndPopulateWorkspaceRunnable doesn'tadd the prpolated projects
to the Maven Projects cache.
  • Loading branch information
vrubezhny committed Jun 13, 2023
1 parent 08d453e commit 3f99ccc
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ public void run() {
skipFlushBeforeResult.set(true); // avoid deadlock as building project will go through this workspace reader
Optional<MavenProject> snapshotProject = Optional.empty();
try {
snapshotProject = plugin.getProjectCache().getSnapshotProject(pomFile);
// Just getting a snapshot project is not enough here because
// it doesn't adds the read projects to the projects cache
// So we need to parse and cache the project here
//
// snapshotProject = plugin.getProjectCache().getSnapshotProject(pomFile);
DOMDocument ocumentt = org.eclipse.lemminx.utils.DOMUtils.loadDocument(
pomFile.toURI().toString(),
plugin.getUriResolveExtentionManager());
snapshotProject = Optional.of(plugin.getProjectCache().getLastSuccessfulMavenProject(ocumentt));
} catch (Exception e) {
// We shouldn't fail here, otherwise, the pomFile will never be processed
// causing a possible deadlock in "Flush Before Result" loops
Expand Down Expand Up @@ -296,7 +304,7 @@ public void addToWorkspace(Collection<URI> uris) {
.filter(File::isFile)
.filter(file -> !workspaceArtifacts.values().contains(file)) // ignore already processed
.forEach(toProcess::add);
for (File file : toProcess.stream().collect(Collectors.toSet())) {
for (File file : toProcess.stream().collect(Collectors.toList())) {
executor.execute(new ResolveArtifactsAndPopulateWorkspaceRunnable(file));
}
}
Expand Down

0 comments on commit 3f99ccc

Please sign in to comment.