X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fmaven-fetch-metadata.sh;h=f07bb78e26a9b643b99bbf567fdc347cd6fb3849;hb=refs%2Fchanges%2F35%2F15035%2F12;hp=d3670d067ff4af46ddb4b57d38395176a159fdc2;hpb=ed320523c5e3c70a6f54cf9f57369f8305f9b342;p=releng%2Fglobal-jjb.git diff --git a/shell/maven-fetch-metadata.sh b/shell/maven-fetch-metadata.sh index d3670d06..f07bb78e 100644 --- a/shell/maven-fetch-metadata.sh +++ b/shell/maven-fetch-metadata.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. @@ -11,8 +11,19 @@ # Uses wget to fetch a project's maven-metadata.xml files from a Maven repository. +# Check for "-f" maven param, indicating a change in pom location. +pom_path="pom.xml" +file_path=$(echo $MAVEN_PARAMS | grep -E "\-f \S+" | awk '{ print $2 }') +if [ ! -z $file_path ]; then + if [ -d $file_path ]; then + pom_path="$file_path/pom.xml" + else + pom_path="$file_path" + fi +fi + # Ensure we fail the job if any steps fail. -set -eu -o pipefail +set -xeu -o pipefail project=$(xmlstarlet sel \ -N "x=http://maven.apache.org/POM/4.0.0" -t \ @@ -20,7 +31,7 @@ project=$(xmlstarlet sel \ -v "/x:project/x:groupId" \ --elif "/x:project/x:parent/x:groupId" \ -v "/x:project/x:parent/x:groupId" \ - --else -o "" pom.xml) + --else -o "" $pom_path) project_path="${project//.//}" mkdir -p "$WORKSPACE/m2repo/$project_path"