From 6ebb627e363e499a75f68d4b47c07bd4832a3535 Mon Sep 17 00:00:00 2001 From: Josh Steinberg <jsteinberg@nisum.com> Date: Thu, 16 Jun 2022 11:14:44 -0400 Subject: [PATCH] update jenkins to pull nexus --- Jenkinsfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b0c74f1..d775d6b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -76,12 +76,17 @@ pipeline { stage("Pull from Nexus"){ steps{ + script{ + pom = readMavenPom file: "pom.xml"; + GROUP_ID=pom.groupId + ARTIFACT_ID=pom.artifactId + LOCAL_FILE="spring-boot-complete-0.0.1-SNAPSHOT.jar" - script{ - pom = readMavenPom file: "pom.xml"; - sh 'curl http://${NEXUS_URL/nexus/service/local/artifact/maven/redirect?r=${NEXUS_REPOSITORY}&g=${pom.groupId}&a=${pom.artifactId}&v=${pom.version}&p=jar' - - } + NEXUS_RESOLVE_URL="${NEXUS_BASE_URL}artifact/maven/resolve?g=${GROUP_ID}a=${ARTIFACT_ID}&r=${NEXUS_REPOSITORY}&v=${NEXUS_VERSION}" + REPOSITORY_LOCAL_PATH=`curl -s "${NEXUS_RESOLVE_URL}" | xmllint --xpath "//artifact-resolution/data/repositoryPath/text()" -` + ARTIFACT_DOWNLOAD_URL="${NEXUS_BASE_URL}/repositories/${NEXUS_REPOSITORY}/content${REPOSITORY_LOCAL_PATH}" + curl -o "${LOCAL_FILE}" "${ARTIFACT_DOWNLOAD_URL}" + } } } } -- 2.18.1