feat(java): Add Project JDK and Maven home / settings.xml / local repository settings

The JDK was always picked automatically (JAVA_HOME, PATH, the usual install dirs, by the
module's Java version) and Maven was the project's mvnw or mvn on PATH, with no way to
override either. languages.java.jdk (Languages & Frameworks › Java › Project JDK) now sets
the default jdtls runtime, the JDK of Run/Debug and JAVA_HOME for Maven and Gradle;
languages.java.maven (Build Tools › Maven) sets the Maven home, -s and
-Dmaven.repo.local for sync, builds, tool-window goals and detected run configurations.
JDKs and Maven installations are detected for the pickers.

Closes #13
This commit is contained in:
l0ng-ai committed 2026-10-23 23:00:48 +08:00
1 parent c59f93988b
commit 7fa1d08b94
22 files changed
+484 -48

No files matched your search

+16 -3
View File
@@ -11,7 +11,11 @@ export interface LanguagesValid {
rust: { toolchain: string; stdlib: string; checkOnSave: boolean; checkCommand: "check" | "clippy"; rustfmtArgs: string };
go: { goroot: string; gopath: string };
typescript: { version: string };
java: { jdtlsVmArgs: string };
java: {
jdk: string;
jdtlsVmArgs: string;
maven: { home: string; userSettings: string; localRepository: string };
};
}
export interface ProjectStructureValid {
@@ -30,7 +34,7 @@ export const DEFAULT_LANGUAGES: LanguagesValid = {
rust: { toolchain: "", stdlib: "", checkOnSave: true, checkCommand: "check", rustfmtArgs: "" },
go: { goroot: "", gopath: "" },
typescript: { version: "bundled" },
java: { jdtlsVmArgs: "" },
java: { jdk: "", jdtlsVmArgs: "", maven: { home: "", userSettings: "", localRepository: "" } },
};
export const DEFAULT_PROJECT_STRUCTURE: ProjectStructureValid = {
@@ -76,6 +80,7 @@ export function validateLanguages(raw: unknown): LanguagesValid {
const go = obj(l.go);
const ts = obj(l.typescript);
const java = obj(l.java);
const maven = obj(java.maven);
return {
python: {
interpreter: text(py.interpreter, d.python.interpreter),
@@ -94,7 +99,15 @@ export function validateLanguages(raw: unknown): LanguagesValid {
},
go: { goroot: text(go.goroot, d.go.goroot), gopath: text(go.gopath, d.go.gopath) },
typescript: { version: text(ts.version, d.typescript.version) || d.typescript.version },
java: { jdtlsVmArgs: text(java.jdtlsVmArgs, d.java.jdtlsVmArgs) },
java: {
jdk: text(java.jdk, d.java.jdk),
jdtlsVmArgs: text(java.jdtlsVmArgs, d.java.jdtlsVmArgs),
maven: {
home: text(maven.home, d.java.maven.home),
userSettings: text(maven.userSettings, d.java.maven.userSettings),
localRepository: text(maven.localRepository, d.java.maven.localRepository),
},
},
};
}