X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fmaven-fetch-metadata.sh;h=270056f472fa84d561f8f315c5f0448a7980ffd6;hb=2a10c83b2d506008cc6c01c134515fb6328e1f3a;hp=d3670d067ff4af46ddb4b57d38395176a159fdc2;hpb=92c2494543e0e66bfe8cd636efdf8cc618a03b62;p=releng%2Fglobal-jjb.git diff --git a/shell/maven-fetch-metadata.sh b/shell/maven-fetch-metadata.sh index d3670d06..270056f4 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. @@ -8,11 +8,22 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## - +echo "---> maven-fetch-metadata.sh" # 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"