diff --git a/Jenkinsfile b/Jenkinsfile index c998ddea10cfb5c6f8b13ae7ed5a6166845119b9..c4310f2fb7c1dfa385350d1b75c77a64c8655950 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,6 +43,26 @@ 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 NachrichtenManager') { steps { @@ -57,18 +77,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 --no-transfer-progress -s $MAVEN_SETTINGS -DskipTests deploy -Dmaven.wagon.http.retryHandler.count=3' + sh "mvn -s $MAVEN_SETTINGS versions:revert" } } }