Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven Workspace Reader 'findArtifact' should not return cached Maven … #456

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,31 +222,18 @@ public WorkspaceRepository getRepository() {
@Override
public File findArtifact(Artifact artifact) {
String projectKey = ArtifactUtils.key(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
List<MavenProject> projectsCopy = plugin.getProjectCache().getProjects().stream().toList();
return projectsCopy.stream()
.filter(p -> p.getArtifact() != null && projectKey.equals(ArtifactUtils.key(p.getArtifact())))
.map(project -> {
File file = find(project, artifact);
if (file == null && project != project.getExecutionProject()) {
file = find(project.getExecutionProject(), artifact);
}
return file;
}).filter(Objects::nonNull)
.findAny()
.or(() -> {
if (skipFlushBeforeResult.get() != Boolean.TRUE) {
LOGGER.finest("Waiting for " + projectKey + " to be avilable; processing workspace in the meantime...");
while (!toProcess.isEmpty() && getCurrentWorkspaceArtifact(projectKey).isEmpty()) {
try {
Thread.sleep(POLLING_INTERVAL);
} catch (InterruptedException e) {
LOGGER.severe(e.getMessage());
}
}
LOGGER.finest("Done waiting from " + projectKey + ". Either found, or all workspace processed.");
}
return getCurrentWorkspaceArtifact(projectKey);
}).orElse(null);
if (skipFlushBeforeResult.get() != Boolean.TRUE) {
LOGGER.finest("Waiting for " + projectKey + " to be avilable; processing workspace in the meantime...");
while (!toProcess.isEmpty() && getCurrentWorkspaceArtifact(projectKey).isEmpty()) {
try {
Thread.sleep(POLLING_INTERVAL);
} catch (InterruptedException e) {
LOGGER.severe(e.getMessage());
}
}
LOGGER.finest("Done waiting from " + projectKey + ". Either found, or all workspace processed.");
}
return getCurrentWorkspaceArtifact(projectKey).orElse(null);
}

private Optional<File> getCurrentWorkspaceArtifact(String projectKey) {
Expand Down