diff --git a/Jenkinsfile b/Jenkinsfile index 066a038179015c06645015922e4d53b5d103cbaa..00b04d55350f732b175c75749e475a199fb992be 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,25 @@ pipeline { } } } - + stage('Set Version') { + when { + not { + anyOf { + branch 'master' + branch 'release' + } + } + } + steps { + script { + FAILED_STAGE=env.STAGE_NAME + JAR_TAG = getPomVersion('pom.xml').replace("SNAPSHOT", "${env.BRANCH_NAME}-SNAPSHOT") + } + configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { + sh "mvn -s $MAVEN_SETTINGS versions:set -DnewVersion=${JAR_TAG} -DprocessAllModules=true" + } + } + } stage('Build Vorgang-Schnittstelle') { steps { script { @@ -52,18 +70,13 @@ pipeline { } stage('Deploy to Nexus'){ - when { - anyOf { - branch 'master' - branch 'release' - } - } steps { script { FAILED_STAGE = env.STAGE_NAME } configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { sh 'mvn -s $MAVEN_SETTINGS -DskipTests deploy -Dmaven.wagon.http.retryHandler.count=3' + sh "mvn -s $MAVEN_SETTINGS versions:revert" } } }