I'm aware of the fact that this issue has been discussed in several questions but no answer solved my specific issue.
I have installed Git bash and Maven and I'm trying to execute Maven with Git bash. It aborts with the mentioned error.
My system environment:
Windows 7
Git 2.13.3
Maven 3.5.0
The required user variables:
HOME=%HOMEPATH%
M3_HOME=%MAVEN_HOME%
MAVEN_HOME=path-with-no-blanks
Path=%MAVEN_HOME%\bin
Maven works fine on Windows command prompt and Cygwin. Only MINGW-based Git bash fails.
I examined the bash script mvn
under: C:\path\to\maven\bin
By setting log outputs and by checking when MAVEN_HOME
value gets lost I found out that it gets cleared by these statements (even JAVA_HOME
):
# For MinGW, ensure paths are in Unix format before anything is touched !!!HERE MAVEN_HOME value is getting lost!!!
if $mingw ; then
[ -n "$MAVEN_HOME" ] &&
MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`(cd "$JAVA_HOME"; pwd)`
# TODO classpath?
fi
On another Windows machine (different version of Maven and Git) the same lines are a bit different:
M2_HOME="`(cd "$MAVEN_HOME"; pwd)`"
instead of:
MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
First, I thought it's due to the kind of quotation characters. But the working Windows machine even runs well with the new script from my failing Windows machine. I also tried to install the old Git or an older Maven - nothing helps.
Why does the mentioned bash script line clears the MAVEN_HOME
variable?