From: Eric Ball Date: Wed, 20 Mar 2019 00:51:34 +0000 (-0700) Subject: Adapt maven path search for files and dirs X-Git-Tag: v0.34.0~3 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F14968%2F3;p=releng%2Fglobal-jjb.git Adapt maven path search for files and dirs The "-f" maven param can specify both a directory, in which case it will look for "pom.xml" in the directory, or a specific file. The original version of this search was only compatible with directories that contain a pom.xml file. Change-Id: I81ab161f3156fc2159a4b7ca9ca084a0f82da795 Signed-off-by: Eric Ball --- diff --git a/releasenotes/notes/fetch-metadata-fix-8c2273c284ba9745.yaml b/releasenotes/notes/fetch-metadata-fix-8c2273c284ba9745.yaml new file mode 100644 index 00000000..409cb8af --- /dev/null +++ b/releasenotes/notes/fetch-metadata-fix-8c2273c284ba9745.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Adapt maven path search for files and dirs. The "-f" maven param can + specify both a directory, in which case it will look for "pom.xml" in the + directory, or a specific file. The original version of this search was only + compatible with directories that contain a pom.xml file. diff --git a/shell/maven-fetch-metadata.sh b/shell/maven-fetch-metadata.sh index 4696451b..f07bb78e 100644 --- a/shell/maven-fetch-metadata.sh +++ b/shell/maven-fetch-metadata.sh @@ -15,7 +15,11 @@ 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" + 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.