дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 09:41:34 +02:00
Offline mode in the Maven tool window only added -o to sync's mvn; jdtls's m2e kept downloading. Each sync now records the offline mode (in the build cache, like profiles) and jdtls follows it via java.import.maven.offline.enabled, reconfigured when it changes; toggling offline reloads Maven. Offline sync keeps maven-dependency-plugin 3.8.1 when the local repository has it, and "No plugin found for prefix 'help'" now explains why and offers Open Maven Settings. Co-authored-by: wildcatDownstairs <[email protected]>
53 рядки
2.6 KiB
TypeScript
53 рядки
2.6 KiB
TypeScript
import { executeAction } from "./actions";
|
|
import { tx } from "./i18n";
|
|
import { downloadJdkActions } from "./jdk";
|
|
|
|
/** Recovery shared by build sync, run configurations and language-server import errors. */
|
|
export function buildToolRecovery(message: string) {
|
|
if (message.startsWith("tsserver stopped because it reached its memory limit")) {
|
|
const settings = {
|
|
label: tx("Language Servers…"),
|
|
run: () => void executeAction("file.settings", "languages.servers"),
|
|
};
|
|
return { body: message, actions: [settings] };
|
|
}
|
|
const actions = downloadJdkActions(message);
|
|
if (/No plugin found for prefix '[^']+'/.test(message)) {
|
|
// Offline, or without the user's mirrors: the plugin group metadata is not in the local repository.
|
|
actions.push({ label: tx("Open Maven Settings"), run: () => void executeAction("file.settings", "build.maven") });
|
|
const hint = tx(
|
|
"Maven could not find a plugin the reload uses. In offline mode it must already be in the local repository: turn offline mode off and reload once. Otherwise check the settings.xml and local repository in Maven settings.",
|
|
);
|
|
return { body: `${hint}\n\n${message}`, actions };
|
|
}
|
|
const incompatible = /Can't use Java .* and Gradle .* to import Gradle project/i.test(message);
|
|
const missing = /command not found: ([^\r\n]+)|cannot start ([^\r\n]+?): [^\r\n]*\(os error [23]\)/i.exec(message);
|
|
const command = (missing?.[1] ?? missing?.[2] ?? "").trim().replace(/^["'`]|["'`]$/g, "");
|
|
const namedTool = /(?:^|[/\\])(?:mvn|mvnw|mvnd)(?:\.(?:cmd|bat|exe))?$/i.test(command)
|
|
? "maven"
|
|
: /(?:^|[/\\])gradlew?(?:\.(?:bat|exe))?$/i.test(command)
|
|
? "gradle"
|
|
: undefined;
|
|
const recoveryTool = incompatible ? "gradle" : namedTool;
|
|
if (!recoveryTool) return { body: message, actions };
|
|
const label =
|
|
recoveryTool === "maven"
|
|
? tx("Open Maven Settings")
|
|
: incompatible
|
|
? tx("Choose Gradle JVM")
|
|
: tx("Open Gradle Settings");
|
|
actions.push({ label, run: () => void executeAction("file.settings", `build.${recoveryTool}`) });
|
|
const hint = incompatible
|
|
? tx(
|
|
"Choose a JDK compatible with this Gradle version in Gradle JVM. Download JDK is available in the JVM selector.",
|
|
)
|
|
: recoveryTool === "maven"
|
|
? tx(
|
|
"Maven could not be started. Configure Maven home in Maven settings, install Maven on PATH, or use a project with a Maven wrapper.",
|
|
)
|
|
: tx(
|
|
"Gradle could not be started. Configure a local installation in Gradle settings, install Gradle on PATH, or use a project with a Gradle wrapper.",
|
|
);
|
|
return { body: `${hint}\n\n${message}`, actions };
|
|
}
|