From ade1c2d4bfff1f9c72e0f91576f0a881c8478ad6 Mon Sep 17 00:00:00 2001 From: Kyle Willmon Date: Fri, 13 Sep 2024 14:48:58 -0500 Subject: [PATCH] Use mvn.cmd on Windows --- lockfile_generator/src/maven.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lockfile_generator/src/maven.rs b/lockfile_generator/src/maven.rs index 84aaf2cb5..1b6ec2052 100644 --- a/lockfile_generator/src/maven.rs +++ b/lockfile_generator/src/maven.rs @@ -7,6 +7,16 @@ use crate::{Error, Generator, Result}; pub struct Maven; +#[cfg(not(windows))] +fn maven_command() -> Command { + Command::new("mvn") +} + +#[cfg(windows)] +fn maven_command() -> Command { + Command::new("mvn.cmd") +} + impl Generator for Maven { fn lockfile_path(&self, manifest_path: &Path) -> Result { let project_path = manifest_path @@ -17,7 +27,7 @@ impl Generator for Maven { fn command(&self, manifest_path: &Path) -> Command { let lockfile_path = self.lockfile_path(manifest_path).unwrap(); - let mut command = Command::new("mvn"); + let mut command = maven_command(); command.args([ "-q", "help:effective-pom",