Let's say that we have a jenkins pipeline that at some point we execute a maven parameterized build:
sh "mvn clean install -DparameterType=${parameter}"
What if the parameter's value contained spaces? Eg the value was "test param".
When running on IDE, this of course works:
mvn clean install -DparameterType="test param"
But if we do sth similar inside the pipeline, like
sh "mvn clean install -DparameterType=\"${parameter}\""
or
sh "mvn clean install -DparameterType=""${parameter}""
it doesn't and the param is passed like
-DparameterType=test param
which is not good for maven. Any ideas please?
You can try using: