From fa9b9aba2fe181a2b6cea95892fecdebc4eded36 Mon Sep 17 00:00:00 2001 From: Manfred Moser Date: Tue, 4 Apr 2017 23:56:18 -0700 Subject: [PATCH] support spaces in folder names on nix, simplified from https://github.com/takari/maven-wrapper/pull/25 --- maven-wrapper/mvnw | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/maven-wrapper/mvnw b/maven-wrapper/mvnw index ed12f821e1..8176e8e958 100755 --- a/maven-wrapper/mvnw +++ b/maven-wrapper/mvnw @@ -165,8 +165,15 @@ CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { - local basedir="`pwd`" - local wdir="$basedir" + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + local basedir="$1" + local wdir="$1" while [ "$wdir" != '/' ] ; do if [ -d "$wdir"/.mvn ] ; then basedir=$wdir @@ -184,7 +191,13 @@ concat_lines() { fi } -export MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-$(find_maven_basedir)}" +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +echo $MAVEN_PROJECTBASEDIR MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java