Skip to content

Commit

Permalink
[MNG-5607] Don't use M2_HOME anymore in mvn shell/batch file anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianSchulte committed Jan 27, 2016
1 parent 2fb5fd5 commit 364df32
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 38 deletions.
39 changes: 18 additions & 21 deletions apache-maven/src/bin/mvn
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
Expand Down Expand Up @@ -94,31 +93,29 @@ if [ -z "$JAVA_HOME" ] ; then
fi
fi

if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
## resolve links - $0 may be a link to maven's home
PRG="$0"

# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done

saveddir=`pwd`
saveddir=`pwd`

M2_HOME=`dirname "$PRG"`/..
M2_HOME=`dirname "$PRG"`/..

# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`

cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
cd "$saveddir"
# echo Using m2 at $M2_HOME

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
Expand Down
15 changes: 0 additions & 15 deletions apache-maven/src/bin/mvn.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
Expand Down Expand Up @@ -77,16 +76,8 @@ echo.
goto error

:chkMHome
if not "%M2_HOME%"=="" goto valMHome

SET "M2_HOME=%~dp0.."
if not "%M2_HOME%"=="" goto valMHome

echo.
echo Error: M2_HOME not found in your environment. >&2
echo Please set the M2_HOME variable in your environment to match the >&2
echo location of the Maven installation. >&2
echo.
goto error

:valMHome
Expand All @@ -99,12 +90,6 @@ goto stripMHome
:checkMCmd
if exist "%M2_HOME%\bin\mvn.cmd" goto init

echo.
echo Error: M2_HOME is set to an invalid directory. >&2
echo M2_HOME = "%M2_HOME%" >&2
echo Please set the M2_HOME variable in your environment to match the >&2
echo location of the Maven installation >&2
echo.
goto error
@REM ==== END VALIDATION ====

Expand Down
1 change: 0 additions & 1 deletion apache-maven/src/bin/mvnDebug
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
Expand Down
1 change: 0 additions & 1 deletion apache-maven/src/bin/mvnyjp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
Expand Down

0 comments on commit 364df32

Please sign in to comment.