Adapt maven path search for files and dirs 68/14968/3
authorEric Ball <eball@linuxfoundation.org>
Wed, 20 Mar 2019 00:51:34 +0000 (17:51 -0700)
committerEric Ball <eball@linuxfoundation.org>
Wed, 20 Mar 2019 21:50:24 +0000 (14:50 -0700)
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 <eball@linuxfoundation.org>
releasenotes/notes/fetch-metadata-fix-8c2273c284ba9745.yaml [new file with mode: 0644]
shell/maven-fetch-metadata.sh

diff --git a/releasenotes/notes/fetch-metadata-fix-8c2273c284ba9745.yaml b/releasenotes/notes/fetch-metadata-fix-8c2273c284ba9745.yaml
new file mode 100644 (file)
index 0000000..409cb8a
--- /dev/null
@@ -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.
index 4696451..f07bb78 100644 (file)
 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.