Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

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

arookieofc6669df831349
diff --git a/crates/ide-build/src/web.rs b/crates/ide-build/src/web.rs
index c986dee90..c918bb8ee 100644
--- a/crates/ide-build/src/web.rs
+++ b/crates/ide-build/src/web.rs
@@ -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() {
diff --git a/crates/ide-run/src/tomcat.rs b/crates/ide-run/src/tomcat.rs
index 7410dd187..0f452e0bc 100644
--- a/crates/ide-run/src/tomcat.rs
+++ b/crates/ide-run/src/tomcat.rs
@@ -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));
}
}
diff --git a/src/features/build-tools/BuildToolView.tsx b/src/features/build-tools/BuildToolView.tsx
index ac3ab85f2..c6209f482 100644
--- a/src/features/build-tools/BuildToolView.tsx
+++ b/src/features/build-tools/BuildToolView.tsx
@@ -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>
);
}
diff --git a/src/features/build-tools/actions.test.tsx b/src/features/build-tools/actions.test.tsx
index 5c7b4359b..af8ffa036 100644
--- a/src/features/build-tools/actions.test.tsx
+++ b/src/features/build-tools/actions.test.tsx
@@ -78,6 +78,7 @@ describe("build tools feature", () => {
"maven.analyzeDependencies",
"maven.executeGoal",
"maven.reload",
+ "maven.settings",
"maven.toggleOffline",
"maven.toggleSkipTests",
]);
diff --git a/src/features/build-tools/index.ts b/src/features/build-tools/index.ts
index 86c908295..506344757 100644
--- a/src/features/build-tools/index.ts
+++ b/src/features/build-tools/index.ts
@@ -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",
diff --git a/src/platform/keymaps/vscode-macos.ts b/src/platform/keymaps/vscode-macos.ts
index 174c1f041..2b7ceb345 100644
--- a/src/platform/keymaps/vscode-macos.ts
+++ b/src/platform/keymaps/vscode-macos.ts
@@ -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"],
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
index ac2c173a6..350d1cdb7 100644
--- a/src/platform/locales/text/zh.json
+++ b/src/platform/locales/text/zh.json
@@ -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",