From bda26a9a154d727ed0c838cdf623ff4d396557a0 Mon Sep 17 00:00:00 2001 From: johnniang Date: Fri, 23 Apr 2021 14:09:23 +0800 Subject: [PATCH] Add batch option for maven command --- Jenkinsfile-on-prem | 4 ++-- Jenkinsfile-online | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile-on-prem b/Jenkinsfile-on-prem index 2a2549be..c622b7f8 100644 --- a/Jenkinsfile-on-prem +++ b/Jenkinsfile-on-prem @@ -46,7 +46,7 @@ pipeline { stage ('unit test') { steps { container ('maven') { - sh 'mvn clean -o -gs `pwd`/configuration/settings.xml test' + sh 'mvn -B -o -gs `pwd`/configuration/settings.xml clean test' } } } @@ -54,7 +54,7 @@ pipeline { stage ('build & push') { steps { container ('maven') { - sh 'mvn -o -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package' + sh 'mvn -B -o -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package' sh 'docker build -f Dockerfile-on-prem -t $REGISTRY/$HARBOR_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .' withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$HARBOR_CREDENTIAL_ID" ,)]) { sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin' diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 2ca69e7f..f32ebb66 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -29,7 +29,7 @@ pipeline { stage ('unit test') { steps { container ('maven') { - sh 'mvn clean -gs `pwd`/configuration/settings.xml test' + sh 'mvn -B -gs `pwd`/configuration/settings.xml clean test' } } } @@ -37,7 +37,7 @@ pipeline { stage ('build & push') { steps { container ('maven') { - sh 'mvn -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package' + sh 'mvn -B -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package' sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .' withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) { sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'