Repository: maven
Updated Branches:
refs/heads/master d3b4fb0c1 -> e37117e30
[MNG-5607] Don't use M2_HOME anymore in mvn shell/batch file anymore
o Updated to revert commits
d3b4fb0c1e525bb1122c7e832279f1ef6fbd6efe
364df32335a9c36986418498f654bf744d466767
o Variable M2_HOME will be removed without replacement in Maven 4.
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/e37117e3
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/e37117e3
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/e37117e3
Branch: refs/heads/master
Commit: e37117e304d17e5b2defb4b2f7b2c67c0e2a1fe2
Parents: d3b4fb0
Author: Christian Schulte <[email protected]>
Authored: Wed Jan 27 15:07:31 2016 +0100
Committer: Christian Schulte <[email protected]>
Committed: Wed Jan 27 15:21:49 2016 +0100
----------------------------------------------------------------------
apache-maven/src/bin/mvn | 57 ++++++++++++++++++++------------------
apache-maven/src/bin/mvn.cmd | 29 ++++++++++++++-----
apache-maven/src/bin/mvnDebug | 1 +
apache-maven/src/bin/mvnyjp | 1 +
4 files changed, 54 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/e37117e3/apache-maven/src/bin/mvn
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index 7a636cd..c815839 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -27,6 +27,7 @@
#
# 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
@@ -93,34 +94,36 @@ if [ -z "$JAVA_HOME" ] ; then
fi
fi
-## resolve links - $0 may be a link to maven's home
-PRG="$0"
+if [ -z "$M2_HOME" ] ; then
+ ## 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`
-MVN_HOME=`dirname "$PRG"`/..
+ M2_HOME=`dirname "$PRG"`/..
-# make it fully qualified
-MVN_HOME=`cd "$MVN_HOME" && pwd`
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
-cd "$saveddir"
-# echo Using mvn at $MVN_HOME
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
- [ -n "$MVN_HOME" ] &&
- MVN_HOME=`cygpath --unix "$MVN_HOME"`
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
@@ -129,8 +132,8 @@ fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
- [ -n "$MVN_HOME" ] &&
- MVN_HOME="`(cd "$MVN_HOME"; pwd)`"
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
@@ -180,12 +183,12 @@ if [ -z "$JAVA_HOME" ] ; then
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-CLASSWORLDS_JAR=`echo "${MVN_HOME}"/boot/plexus-classworlds-*.jar`
+CLASSWORLDS_JAR=`echo "${M2_HOME}"/boot/plexus-classworlds-*.jar`
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
- [ -n "$MVN_HOME" ] &&
- MVN_HOME=`cygpath --path --windows "$MVN_HOME"`
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
@@ -239,6 +242,6 @@ exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "${CLASSWORLDS_JAR}" \
- "-Dclassworlds.conf=${MVN_HOME}/bin/m2.conf" \
- "-Dmaven.home=${MVN_HOME}"
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ "-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
+ "-Dmaven.home=${M2_HOME}"
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${CLASSWORLDS_LAUNCHER} "$@"
http://git-wip-us.apache.org/repos/asf/maven/blob/e37117e3/apache-maven/src/bin/mvn.cmd
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index 51ca499..9938663 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -24,6 +24,7 @@
@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
@@ -76,20 +77,34 @@ echo.
goto error
:chkMHome
-SET "MVN_HOME=%~dp0.."
-if not "%MVN_HOME%"=="" goto valMHome
+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
:stripMHome
-if not "_%MVN_HOME:~-1%"=="_\" goto checkMCmd
-set "MVN_HOME=%MVN_HOME:~0,-1%"
+if not "_%M2_HOME:~-1%"=="_\" goto checkMCmd
+set "M2_HOME=%M2_HOME:~0,-1%"
goto stripMHome
:checkMCmd
-if exist "%MVN_HOME%\bin\mvn.cmd" goto init
+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 ====
@@ -136,11 +151,11 @@ for /F "usebackq delims=" %%a in
("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-for %%i in ("%MVN_HOME%"\boot\plexus-classworlds-*) do set
CLASSWORLDS_JAR="%%i"
+for %%i in ("%M2_HOME%"\boot\plexus-classworlds-*) do set CLASSWORLDS_JAR="%%i"
set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS%
-classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%MVN_HOME%\bin\m2.conf"
"-Dmaven.home=%MVN_HOME%"
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%"
%CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS%
-classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf"
"-Dmaven.home=%M2_HOME%"
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%"
%CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
if ERRORLEVEL 1 goto error
goto end
http://git-wip-us.apache.org/repos/asf/maven/blob/e37117e3/apache-maven/src/bin/mvnDebug
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvnDebug b/apache-maven/src/bin/mvnDebug
index ad5aa12..caf0b45 100755
--- a/apache-maven/src/bin/mvnDebug
+++ b/apache-maven/src/bin/mvnDebug
@@ -27,6 +27,7 @@
#
# 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
http://git-wip-us.apache.org/repos/asf/maven/blob/e37117e3/apache-maven/src/bin/mvnyjp
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvnyjp b/apache-maven/src/bin/mvnyjp
index 419e8b1..3ddec42 100755
--- a/apache-maven/src/bin/mvnyjp
+++ b/apache-maven/src/bin/mvnyjp
@@ -27,6 +27,7 @@
#
# 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