diff --git a/Jenkinsfile b/Jenkinsfile index 38190aad4b2000b439a34a9fcdfb373734aa3222..d66a3db106a9013a3e4ade5ae85ed682ab07cdda 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,6 +40,26 @@ pipeline { } } } + stage('Set Version') { + when { + not { + anyOf { + branch 'master' + branch 'release' + } + } + } + steps { + script { + FAILED_STAGE=env.STAGE_NAME + JAR_TAG = getPomVersion().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 Administration') { steps { @@ -54,18 +74,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" } } }