-
Improvement
-
Resolution: Unresolved
-
Minor
-
Jenkins master ver. 2.46.1 on RHEL 7.3
Pipeline maven Integration Plugin 2.0.2
Jenkins slave ver 2.46.1 on Windows 2012 R2
Our build agent environment is configured with Git for Windows 2.11.0.3 added on the paths (/mingw64/bin;/usr/bin) for both the Windows 2012 R2 OS system default path and on the Jenkins Build Agents overridden path. This provides the required "nohup", "bash" and other Unix on Windows command line utilities to allow use of the same sh() pipeline steps in builds directed to Linux agents and Windows agents.Jenkins master ver. 2.46.1 on RHEL 7.3 Pipeline maven Integration Plugin 2.0.2 Jenkins slave ver 2.46.1 on Windows 2012 R2 Our build agent environment is configured with Git for Windows 2.11.0.3 added on the paths (/mingw64/bin;/usr/bin) for both the Windows 2012 R2 OS system default path and on the Jenkins Build Agents overridden path. This provides the required "nohup", "bash" and other Unix on Windows command line utilities to allow use of the same sh() pipeline steps in builds directed to Linux agents and Windows agents.
Request that withMaven pipeline step produce both mvn and mvn.cmd wrappers on Windows.
On Windows build agents we would like the withMaven build step to produce wrappers that work for both bash.exe and cmd.exe. Currently the step adds a directory that adds a script "mvn" on Linux and adds a script "mvn.cmd" on Windows. On Windows it is possible to configure the build server to make available the Git for Windows tool suite which includes bash.exe. We write all of our build scripts in bash syntax so that we can be cross platform on build agents when doing builds that are platform agnostic, like running Java based Maven builds.
We have a work around (see code below) that allows us to do the the build by calling "$COMSPEC" to execute the mvn.cmd. It would be simpler and cleaner if the both a bash.exe compatible "mvn" wrapper and cmd.exe compatible "mvn.cmd" wrapper were produced on the Windows Platform. Note the Git for Windows bash.exe accepts both Unix style paths (/c/Program\ Files, or '/c/Program Files') and Windows style paths (C:\\Program\ Files, or 'C:\Program Files') as long as they are properly escaped or quoted.
When running a withMaven build from a sh() build step on Windows this is our current work around:
withMaven( jdk: config['jdk'], maven: config['maven'], mavenLocalRepo: config['mavenLocalRepo'], mavenSettingsConfig: config['mavenSettingsConfig']) { sh(''' if [[ -e "pom.xml" ]]; then # Run Jenkins maven wrapper script using mvn in Unix bash # or mvn.cmd in cmd.exe from Git for Windows bash if [[ -z "$COMSPEC" ]]; then cmd=(mvn) else cmd=("$COMSPEC" //c mvn.cmd) fi args=(--batch-mode -U -V --settings "$MVN_SETTINGS" clean install -P "$BUILD_PROFILE" "-DxlDeployServerAddress=$XLDEPLOY_SERVER_ADDRESS" "-DxlDeployPort=$XLDEPLOY_PORT" "-DxlDeploySecured=$XLDEPLOY_SECURED" "-DbuildUrl=$BUILD_URL") eval $(printf " %q" "$\{cmd[@]}" "$\{args[@]}") fi ''') }
- is related to
-
JENKINS-44276 Maven fails in pipeline + cygwin
- Open