diff --git a/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java b/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java index 08634695..7ef252eb 100644 --- a/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java +++ b/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java @@ -559,13 +559,13 @@ private String generateMavenWrapperScriptContent(@Nonnull FilePath mvnExec, @Non String lineSep = "\n"; script.append("#!/bin/sh -e").append(lineSep); script.append("echo ----- withMaven Wrapper script -----").append(lineSep); - script.append(mvnExec.getRemote() + " " + mavenConfig + " \"$@\"").append(lineSep); + script.append("\"" + mvnExec.getRemote() + "\" " + mavenConfig + " \"$@\"").append(lineSep); } else { // Windows String lineSep = "\r\n"; script.append("@echo off").append(lineSep); script.append("echo ----- withMaven Wrapper script -----").append(lineSep); - script.append(mvnExec.getRemote() + " " + mavenConfig + " %*").append(lineSep); + script.append("\"" + mvnExec.getRemote() + "\" " + mavenConfig + " %*").append(lineSep); } LOGGER.log(Level.FINER, "Generated Maven wrapper script: \n{0}", script);