дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
fix(maven): refresh stale SNAPSHOT sources on dependency reload (#5490)
After a SNAPSHOT dependency was republished and the project reloaded, navigating into it still showed the old sources: SNAPSHOT file names never change, the cached sources jar was reused as long as it existed, and open library editors kept their text. A sources jar older than its binary jar is now stale and replaced atomically; Maven reload waits for jdtls to finish importing, refreshes stale cached SNAPSHOT sources before reattaching archives, and refreshes open library editors. First-time source downloads still follow the Maven setting.
Цей коміт міститься в:
1 джерело
9d94b00911
коміт
abab90ca60
12 files changed
+508
-105
No files matched your search
@@ -1,10 +1,12 @@
|
||||
package ai.openidea.archives;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
@@ -16,6 +18,8 @@ import org.eclipse.jdt.core.IPackageFragmentRoot;
|
||||
import org.eclipse.jdt.core.JavaCore;
|
||||
import org.eclipse.jdt.ls.core.internal.IDelegateCommandHandler;
|
||||
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
|
||||
import org.eclipse.jdt.ls.core.internal.ProjectUtils;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
|
||||
/**
|
||||
* Re-reads library archives replaced in place (a SNAPSHOT installed again keeps its path). The
|
||||
@@ -26,6 +30,17 @@ import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
|
||||
public final class RefreshArchivesCommand implements IDelegateCommandHandler {
|
||||
@Override
|
||||
public Object executeCommand(String command, List<Object> arguments, IProgressMonitor monitor) throws Exception {
|
||||
if ("openidea.java.updateProjectConfigurations".equals(command)) {
|
||||
List<TextDocumentIdentifier> files = arguments.stream()
|
||||
.filter(String.class::isInstance)
|
||||
.map(uri -> new TextDocumentIdentifier((String) uri))
|
||||
.toList();
|
||||
Collection<IProject> projects = ProjectUtils.getProjectsFromDocumentIdentifiers(files);
|
||||
if (!projects.isEmpty()) {
|
||||
JavaLanguageServerPlugin.getProjectsManager().updateProjects(projects, true).join(0, monitor);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
|
||||
model.refreshExternalArchives(null, monitor);
|
||||
Set<IPath> archives = new HashSet<>();
|
||||
|
||||
Reference in new issue
Заблокувати користувача