X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fmaven-fetch-metadata.sh;h=3c9b78f455801590e127e7aa3aa5e349ce1a3b64;hb=b9eb4581940562effcf67863704a3ec2c47ceca0;hp=4696451bcd11eb19ecc72738bd983126eadd5ae0;hpb=c9e5000a4fdfbb63543b543814e95a480f09f743;p=releng%2Fglobal-jjb.git diff --git a/shell/maven-fetch-metadata.sh b/shell/maven-fetch-metadata.sh index 4696451b..3c9b78f4 100644 --- a/shell/maven-fetch-metadata.sh +++ b/shell/maven-fetch-metadata.sh @@ -8,14 +8,18 @@ # 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 - pom_path="$file_path/pom.xml" +file_path=$(echo "$MAVEN_PARAMS" | grep -Eo "\-f \S+" | awk '{ print $2 }') +if [ -n "$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. @@ -27,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_path) + --else -o "" "$pom_path") project_path="${project//.//}" mkdir -p "$WORKSPACE/m2repo/$project_path"