feat(maven): Maven settings entry in the tool window (#430)

Adds a Maven Settings… action (toolbar button in the Maven tool window, Find Action) that opens Settings › Build, Execution, Deployment › Maven.

Co-authored-by: a-rookie-of-C-language <[email protected]>
This commit is contained in:
arookieofcanda-rookie-of-C-language authored and GitHub committed 2026-10-30 19:20:27 +08:00
1 parent 83eb1ce2ba
commit 6669df8313
7 files changed
+29 -6

No files matched your search

+4 -1
View File
@@ -137,7 +137,10 @@ mod tests {
assert_eq!(a[0].name, "web");
let plan = build(tmp.path(), &model, &a[0].id, &tmp.path().join("base with spaces")).unwrap();
assert!(plan.args.contains(&"-Dexpression=project.artifact.file".into()));
assert!(plan.args.iter().any(|a| a.ends_with("base with spaces/artifact-path.txt")));
assert!(
plan.args.iter().any(|a| a.ends_with("base with spaces/artifact-path.txt")
|| a.ends_with("base with spaces\\artifact-path.txt"))
);
}
#[test]
fn maven_module_build_includes_reactor_dependencies() {
+7 -4
View File
@@ -401,13 +401,13 @@ mod tests {
}
#[test]
fn constructs_platform_commands_without_splitting_paths() {
let home = Path::new("/some path/tomcat");
let home = if cfg!(windows) { Path::new("C:/some path/tomcat") } else { Path::new("/some path/tomcat") };
assert_eq!(
script_command(home, false, "run"),
("sh".into(), vec!["/some path/tomcat/bin/catalina.sh".into(), "run".into()])
("sh".into(), vec![home.join("bin/catalina.sh").to_string_lossy().into_owned(), "run".into()])
);
let (command, args) = script_command(home, true, "run");
assert_eq!(command, "\"/some path/tomcat/bin/catalina.bat\" run");
assert_eq!(command, format!("\"{}\" run", home.join("bin/catalina.bat").display()));
assert!(args.is_empty());
}
#[test]
@@ -469,6 +469,9 @@ mod tests {
assert!(c.env["CATALINA_OPTS"].contains("-Xmx256m"));
assert!(!c.env.get("JAVA_OPTS").is_some_and(|s| s.contains("jdwp")));
assert_eq!(c.env["JRE_HOME"], "/jdk with spaces");
assert!(c.extras.stop_command.unwrap().contains("catalina.sh' stop"));
let stop = c.extras.stop_command.unwrap();
assert!(stop.contains("stop"));
let script = if cfg!(windows) { "catalina.bat" } else { "catalina.sh" };
assert!(stop.contains(script));
}
}
@@ -167,6 +167,9 @@ function Toolbar({ tool, selection }: { tool: BuildTool; selection: BuildNode[]
<span className={styles.sep} />
<IconButton icon="expand-all" size="small" iconSize={16} action={`${tool}.expandAll`} />
<IconButton icon="collapse-all" size="small" iconSize={16} action={`${tool}.collapseAll`} />
{maven && (
<IconButton icon="settings" size="small" iconSize={16} action="maven.settings" title="Maven Settings…" />
)}
</div>
);
}
@@ -78,6 +78,7 @@ describe("build tools feature", () => {
"maven.analyzeDependencies",
"maven.executeGoal",
"maven.reload",
"maven.settings",
"maven.toggleOffline",
"maven.toggleSkipTests",
]);
+11 -1
View File
@@ -3,7 +3,7 @@
* project has that build system, like IDEA. The model is re-read when build
* files change; running goals / tasks goes through the run feature's actions.
*/
import { registerActions } from "@/platform/actions";
import { executeAction, registerActions } from "@/platform/actions";
import { setContext } from "@/platform/context";
import { onIdeEvent, type BuildModel, type BuildTool } from "@/platform/ipc";
import { useProject } from "@/platform/project";
@@ -261,6 +261,16 @@ export function activate(): () => void {
when: MAVEN_WHEN,
run: () => setExpanded("maven", new Set()),
},
{
id: "maven.settings",
title: "Maven Settings…",
description: "Opens Settings › Build, Execution, Deployment › Maven",
category: "Maven",
icon: "settings",
when: MAVEN_WHEN,
keywords: ["maven home", "mvn", "settings", "preferences"],
run: () => void executeAction("file.settings", "build.maven"),
},
{
id: "gradle.reload",
title: "Reload All Gradle Projects",
+1
View File
@@ -256,6 +256,7 @@ export const vscodeMacos: Record<string, string[]> = {
"run.editConfigs": [],
"run.updateApplication": [],
"run.rerun": [],
"run.updateApplication": [],
"coverage.manageReports": [],
"web.openInBrowser": [],
"debug.toggleBreakpoint": ["F9"],
+2
View File
@@ -1133,6 +1133,7 @@
"Maven command line": "Maven 命令行",
"Maven home path": "Maven 主路径",
"Maven projects": "Maven 项目",
"Maven Settings…": "Maven 设置…",
"Maven sync finished with errors": "Maven 同步完成,但有错误",
"Maven wrapper, else mvn on PATH": "Maven wrapper,否则使用 PATH 中的 mvn",
"Maximize": "最大化",
@@ -4752,6 +4753,7 @@
"No history": "无历史记录",
"More Agents…": "更多 Agent…",
"More agents…": "更多 Agent…",
"Opens Settings › Build, Execution, Deployment › Maven": "打开 设置 › 构建、执行、部署 › Maven。",
"Opens Settings › Tools › Agents: installs, updates or removes agents from the ACP Registry.": "打开 设置 › 工具 › Agents:从 ACP Registry 安装、更新或移除 Agent。",
"Search the ACP Registry": "搜索 ACP Registry",
"Search agents": "搜索 Agent",