feat(build): add Maven thread count setting (#1800)

Signed-off-by: Inf1mum <[email protected]>
Цей коміт міститься в:
Vadim Lazuk authored and GitHub committed 2026-11-07 02:49:38 +08:00
1 джерело ebac061a1f
коміт b5974ab3ac
10 files changed
+183 -9

No files matched your search

+5
Переглянути файл
@@ -5349,6 +5349,11 @@ export type MavenSettings = {
* `mvnd` on `PATH` / common install dirs. Only used when `daemon` is on.
*/
mvndHome?: string,
/**
* Thread count of Maven builds (`-T`): a number of threads (`4`) or a core
* multiplier (`2C`, `2.5C`); empty = Maven's default (one thread per module).
*/
threads?: string,
};
export type MemoryCategory =
+3 -1
Переглянути файл
@@ -26,7 +26,7 @@ describe("languages settings", () => {
jdtlsVmArgs: " -Xmx2g ",
jdk: 21,
jdtlsJdk: " /opt/jdk-25 ",
maven: { home: " /opt/maven ", daemon: "yes", mvndHome: " /opt/mvnd " },
maven: { home: " /opt/maven ", daemon: "yes", mvndHome: " /opt/mvnd ", threads: " 2C " },
},
});
expect(v.python).toEqual({ interpreter: "/usr/bin/python3", activateVirtualenv: true });
@@ -45,8 +45,10 @@ describe("languages settings", () => {
linkedProjects: [],
daemon: false,
mvndHome: "/opt/mvnd",
threads: "2C",
});
expect(validateSettings({}).languages).toEqual(DEFAULT_LANGUAGES);
expect(validateLanguages({ java: { maven: { threads: 4 } } }).java.maven.threads).toBe("");
});
it("keeps the Ruby interpreter through settings normalization and defaults to Auto", () => {
+19
Переглянути файл
@@ -477,6 +477,8 @@ export function GradlePage() {
export function MavenPage() {
const [daemon, setDaemon] = useSetting<boolean>("languages.java.maven.daemon");
const [threads, setThreads] = useSetting<string>("languages.java.maven.threads");
const id = useId();
return (
<div className={styles.page}>
<Section>
@@ -506,6 +508,23 @@ export function MavenPage() {
title="Select Local Repository"
hint="Passed as -Dmaven.repo.local."
/>
<Row
label="Thread count"
htmlFor={id}
hint="Passed as -T to Maven builds and run configurations: a thread count (4) or a core multiplier (2C, 2.5C) for parallel builds of multi-module projects. Empty runs Maven serially."
>
<span className={styles.pathRow}>
<Input
id={id}
mono
className={styles.pathInput}
value={threads}
placeholder="4, 2C"
onChange={(e) => setThreads(e.target.value.trim())}
aria-label="Thread count"
/>
</span>
</Row>
<Toggle
label="Use Maven Daemon (mvnd)"
checked={daemon}
+14 -1
Переглянути файл
@@ -144,7 +144,20 @@ export const EXECUTION_PAGES: PageSpec[] = [
group: BUILD_GROUP,
// IntelliJ IDEA: Build Tools › Maven, before Console / Debugger.
order: 359,
keywords: ["maven home", "mvn", "mvnw", "wrapper", "settings.xml", "user settings", "local repository", "m2"],
keywords: [
"maven home",
"mvn",
"mvnw",
"wrapper",
"settings.xml",
"user settings",
"local repository",
"m2",
"thread count",
"threads",
"-T",
"parallel",
],
component: MavenPage,
},
{
+4
Переглянути файл
@@ -128,6 +128,8 @@ export interface LanguagesValid {
linkedProjects: string[];
daemon: boolean;
mvndHome: string;
/** `-T`: a thread count (4) or a core multiplier (2C, 2.5C); empty = Maven's default. */
threads: string;
};
};
/** Preview font size in px; `null` follows the editor font size. */
@@ -181,6 +183,7 @@ export const DEFAULT_LANGUAGES: LanguagesValid = {
linkedProjects: [],
daemon: false,
mvndHome: "",
threads: "",
},
},
markdown: { previewFontSize: null },
@@ -331,6 +334,7 @@ export function validateLanguages(raw: unknown): LanguagesValid {
linkedProjects: folders(maven.linkedProjects),
daemon: bool(maven.daemon, d.java.maven.daemon),
mvndHome: text(maven.mvndHome, d.java.maven.mvndHome),
threads: text(maven.threads, d.java.maven.threads),
},
},
markdown: { previewFontSize: previewSize(markdown.previewFontSize) },
+3
Переглянути файл
@@ -1272,6 +1272,9 @@
"Maven sync finished with errors": "Maven 同步完成,但有错误",
"Maven wrapper, else mvn on PATH": "Maven wrapper,否则使用 PATH 中的 mvn",
"MVND_HOME, else auto-detected": "MVND_HOME,否则自动检测",
"Passed as -T to Maven builds and run configurations: a thread count (4) or a core multiplier (2C, 2.5C) for parallel builds of multi-module projects. Empty runs Maven serially.": "以 -T 传给 Maven 构建和运行配置:线程数(如 4)或内核倍数(如 2C、2.5C),用于多模块工程的并行构建。留空则串行运行 Maven。",
"Thread count": "线程数",
"4, 2C": "4、2C",
"Maximize": "最大化",
"Maximize Tool Window": "最大化工具窗口",
"Maximum local history size per project": "每个项目的最大本地历史记录大小",