The issue is partially related to both:
This issue only happens on Windows, and is closely related to how the Maven executable is called, and how that execution works when spaces are involved. Thus in my opinion it's a bug of the Jenkins' Maven plugin, as a manual call to Maven in a prompt works OK.
Please note that this bug is blocking in a very common use-case (maven-release-plugin taking arguments from the command line). I hope you can fix it soon...
We use the maven-release-plugin in one of our jobs and we have two parameters to the job "releaseVersion" and "developmentVersion" (cf. maven-release-plugin documentation for more details). With the maven-release-plugin there is the need to pass parameters from the mvn.exe executed by Jenkins to the underlying mvn.exe launched by the plugin itself (maven-release-plugin executes its own new mvn.exe). This is a very common use-case.
Here's what it looks like if I launch it on my computer:
As you can see i have to surround the "arguments" property's value with double-quotes because every parameter inside this value is space-separated.
But if i try to do that in Jenkins it fails. To be clear, here's what i provide to the Maven build step as the properties and goals :
- job parameters : releaseVersion and developmentVersion
- goals : -B -U release:prepare release:perform
- properties :
And here's the log:
As you can see, the call made to cmd.exe surrounds the command to be launched by single-quotes AND double-quotes. And as a consequence, any double quotes inside that command are breaking the behaviour. The double-quotes surrounding "-Darguments" and its value make the parsing fail.
In order to work properly i think only the executable should be surrounded by double-quotes in the /C flag of cmd.exe. Here's what I expect to work:
Thanks for your help.