The Pipeline Maven Plugin and its "withMaven()" wrapper make it very easy to create Maven releases from pipeline. "withMaven()" automatically archive and fingerprint the generated artifacts, publishes the Junit / SureFire reports...
Sample:
node {
stage ('Release') {
withMaven(mavenSettingsConfig: 'settings-for-multi-module-maven-project', maven: 'maven-3.3.9') {
git "https:
sh "mvn release:prepare release:perform"
}
}
}
We recommend to define the maven settings file and its credentials through the Config File Provider Plugin.
The git configuration (author email and name) can be injected with environment variables:
node {
stage ('Release') {
withEnv([
'GIT_AUTHOR_NAME=My Team',
'GIT_AUTHOR_EMAIL=my-team@example.com']) {
withMaven(mavenSettingsConfig: 'settings-for-multi-module-maven-project', maven: 'maven-3.3.9') {
git "https:
sh "mvn release:prepare release:perform"
}
}
}
}
Probably never going to happen. This plugin is tightly tied to maven-plugin. There is no obvious Pipeline equivalent.