pipeline-maven-3.0.3
cyrille-leclerc
released this
29 Jan 15:16
·
1118 commits
to master
since this release
- JENKINS-47823
withMaven
fails to inject Maven settings files with docker-pipeline 1.14. When usingwithMaven
indocker.image('my-image').inside{}
and docker-pipeline 1.14:- Either prepend the PATH environment varizbles when invoking "mvn"
sh 'export PATH=$MVN_CMD_DIR:$PATH && mvn clean deploy'
- Or use Takari's Maven Wrapper
sh './mvnw clean deploy'
- Introduce the
MVN_CMD_DIR
environment variable in addition to theMVN_CMD
variable introduced in 3.0.3-beta-1 because a file cannot be added to thePATH
, it must be the parent folder of this file that is added to thePATH
Pattern to use withMaven()
in a docker.image().inside{}
step of docker-pipeline 1.14
node("linux-agent-with-docker") {
docker.image('maven').inside {
withMaven(mavenSettingsConfig: 'my-maven-settings') {
git "https://github.com/cyrille-leclerc/my-jar.git"
// prepend the $MVN_CMD_DIR variable to the $PATH environment variable
// in each "sh" step that invokes mvn
sh 'export PATH=$MVN_CMD_DIR:$PATH && mvn help:effective-settings'
}
}
}
Troubleshooting
// prepend the $MVN_CMD_DIR variable to the $PATH environment variable
// in each "sh" step that invokes mvn
// for troubleshooting, we display `which mvn`
sh 'export PATH=$MVN_CMD_DIR:$PATH && which mvn && mvn help:effective-settings'