From 8eea9f6b9017ec8fc8e31b184a801ac9445dcc8b Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Thu, 26 Oct 2017 17:22:42 +0200 Subject: [PATCH] Fixed withMaven issue --- Jenkinsfile | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cd330e1..eab90f5 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,15 +1,19 @@ #!groovy // Jenkinsfile (Pipeline Script) -withMaven(jdk: "jdk8", maven: "m3.5", mavenLocalRepo: ".repository", mavenSettingsConfig: "639c4560-87b7-4502-bb3d-2c44845cd2b5") { - node { - // Configure environment - env.REPO_URL = "repo.koc.se/zutil-java.git" //scm.getUserRemoteConfigs()[0].getUrl() - env.BUILD_NAME = "BUILD-" + env.BUILD_ID - stage('Checkout') { - git url: "https://" + env.REPO_URL - } +mavenConfiguration = [ + jdk: "jdk8", + maven: "m3.5", + mavenLocalRepo: ".repository", + mavenSettingsConfig: "639c4560-87b7-4502-bb3d-2c44845cd2b5" +] +node { + stage('Checkout') { + git url: "https://" + env.REPO_URL + } + + withMaven(mavenConfiguration) { stage('Build') { sh 'mvn clean compile' } @@ -20,24 +24,19 @@ withMaven(jdk: "jdk8", maven: "m3.5", mavenLocalRepo: ".repository", mavenSettin stage('Package') { sh 'mvn -DskipStatic -DskipTests package' - - // Tag artifact - withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491', - usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { - sh "git tag ${env.BUILD_NAME}" - sh "git push 'https://${USERNAME}:${PASSWORD}@${env.REPO_URL}' ${env.BUILD_NAME}" - } } stage('Deploy') { sh 'mvn -DskipStatic -DskipTests deploy' } } +} - stage('Release') { - timeout(time: 1, unit: 'HOURS') { - input message: 'Deploy?', submitter: 'ziver' - node { +stage('Release') { + timeout(time: 1, unit: 'HOURS') { + input message: 'Deploy?', submitter: 'ziver' + node { + withMaven(mavenConfiguration) { sh 'mvn --batch-mode -DskipStatic -DskipTests release:prepare release:perform' } }