From 506549fdb058b4f14aa6d6def5a302a3834b6bbd Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Mon, 23 Jun 2014 10:12:53 -0400 Subject: [PATCH] Fix mvn detection When mvn is not detected (not in executor's path), 'set -e' causes the detection to terminate the script before the helpful error message can be displayed. --- make-distribution.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make-distribution.sh b/make-distribution.sh index ae52b4976dc25..6f708e0ebff6c 100755 --- a/make-distribution.sh +++ b/make-distribution.sh @@ -89,12 +89,12 @@ if [ -z "$JAVA_HOME" ]; then exit -1 fi -VERSION=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null | grep -v "INFO" | tail -n 1) -if [ $? != 0 ]; then +if ! which mvn &>/dev/null; then echo -e "You need Maven installed to build Spark." echo -e "Download Maven from https://maven.apache.org/" exit -1; fi +VERSION=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null | grep -v "INFO" | tail -n 1) JAVA_CMD="$JAVA_HOME"/bin/java JAVA_VERSION=$("$JAVA_CMD" -version 2>&1)