From d22c3fe8f7bc3f3276dedd7448c4f82f50fe7584 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Thu, 18 Jan 2018 20:24:26 -0500 Subject: [PATCH] Allow goal override for maven-build macro Splits out the maven-build into a macro that can be used to allow projects to override the default goals if they wish to tweak them for their projects. Change-Id: I8cabbac997d165bfe8b68d76b78cdb4bb7cc4bbc Signed-off-by: Thanh Ha --- docs/jjb/lf-maven-jobs.rst | 10 ++++++++++ jjb/lf-maven-jobs.yaml | 30 +++++++++++++++++++++--------- shell/maven-build.sh | 2 +- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/docs/jjb/lf-maven-jobs.rst b/docs/jjb/lf-maven-jobs.rst index 71b6893f..939aaf8b 100644 --- a/docs/jjb/lf-maven-jobs.rst +++ b/docs/jjb/lf-maven-jobs.rst @@ -52,6 +52,16 @@ Jobs for Maven projects to generate javadoc using GitHub. Macros ====== +lf-maven-build +-------------- + +Calls the maven build script to perform a maven build. + +:Required parameters: + + :mvn-goals: The maven goals to perform for the build. + (default: clean deploy) + lf-maven-common --------------- diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index 9f7173ab..f127e91c 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -52,6 +52,15 @@ # Macros # ########## +- builder: + name: lf-maven-build + builders: + - inject: + properties-content: 'MAVEN_GOALS={mvn-goals}' + - shell: !include-raw-escape: + - ../shell/common-variables.sh + - ../shell/maven-build.sh + - builder: name: lf-maven-deploy builders: @@ -493,6 +502,7 @@ git-url: '$GIT_URL/$PROJECT' java-version: openjdk8 mvn-global-settings: global-settings + mvn-goals: clean deploy mvn-opts: '' mvn-params: '-Dmerge' mvn-version: mvn33 @@ -533,9 +543,9 @@ NEXUS_REPO={nexus-snapshot-repo} - shell: !include-raw-escape: - ../shell/lftools-install.sh - - ../shell/common-variables.sh - ../shell/maven-fetch-metadata.sh - - ../shell/maven-build.sh + - lf-maven-build: + mvn-goals: '{mvn-goals}' - lf-maven-deploy - lf-provide-maven-settings-cleanup @@ -625,6 +635,7 @@ git-url: '$GIT_URL/$PROJECT' java-version: openjdk8 mvn-global-settings: global-settings + mvn-goals: clean deploy mvn-opts: '' mvn-params: '' mvn-version: mvn33 @@ -652,9 +663,9 @@ server-id: '{mvn-staging-id}' - shell: !include-raw-escape: - ../shell/lftools-install.sh - - ../shell/common-variables.sh - ../shell/maven-patch-release.sh - - ../shell/maven-build.sh + - lf-maven-build: + mvn-goals: '{mvn-goals}' - lf-maven-stage - lf-provide-maven-settings-cleanup @@ -891,6 +902,7 @@ git-url: '$GIT_URL/$PROJECT' java-version: openjdk8 mvn-global-settings: global-settings + mvn-goals: clean deploy mvn-opts: '' mvn-params: '-Dstream=$STREAM' mvn-version: mvn33 @@ -927,8 +939,8 @@ settings-file: '{mvn-settings}' - shell: !include-raw-escape: - ../shell/lftools-install.sh - - ../shell/common-variables.sh - - ../shell/maven-build.sh + - lf-maven-build: + mvn-goals: '{mvn-goals}' - lf-provide-maven-settings-cleanup publishers: @@ -1014,6 +1026,7 @@ git-url: '$GIT_URL/$PROJECT' java-version: openjdk8 mvn-global-settings: global-settings + mvn-goals: clean deploy mvn-opts: '' mvn-params: '-Dstream=$STREAM' mvn-version: mvn33 @@ -1047,9 +1060,8 @@ - shell: !include-raw-escape: - ../shell/common-variables.sh - ../shell/maven-build-deps.sh - - shell: !include-raw-escape: - - ../shell/common-variables.sh - - ../shell/maven-build.sh + - lf-maven-build: + mvn-goals: '{mvn-goals}' - lf-provide-maven-settings-cleanup publishers: diff --git a/shell/maven-build.sh b/shell/maven-build.sh index a807a03a..c00aa06f 100644 --- a/shell/maven-build.sh +++ b/shell/maven-build.sh @@ -21,7 +21,7 @@ export MAVEN_OPTS # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters. # shellcheck disable=SC2086 -$MVN clean deploy \ +$MVN $MAVEN_GOALS \ -e \ --global-settings "$GLOBAL_SETTINGS_FILE" \ --settings "$SETTINGS_FILE" \ -- 2.16.6