From 8f91abb60e11d01051b801faaf8d60ad3d292241 Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Tue, 19 Mar 2019 17:51:34 -0700 Subject: [PATCH] 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 --- releasenotes/notes/fetch-metadata-fix-8c2273c284ba9745.yaml | 7 +++++++ shell/maven-fetch-metadata.sh | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fetch-metadata-fix-8c2273c284ba9745.yaml 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. -- 2.16.6