SPARK-1658: Correctly identify if maven is installed and working

Use "set -o pipefail" to catch all pipeline failures and
avoid creating an intermidiate variable.