text
stringlengths
0
834k
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@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
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if ""%MAVEN_BATCH_ECHO%"" == ""on"" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if ""%HOME%"" == """" (set ""HOME=%HOMEDRIVE%%HOMEPATH%"")
@REM Execute a user defined script before this one
if not ""%MAVEN_SKIP_RC%"" == """" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist ""%HOME%\mavenrc_pre.bat"" call ""%HOME%\mavenrc_pre.bat""
if exist ""%HOME%\mavenrc_pre.cmd"" call ""%HOME%\mavenrc_pre.cmd""
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not ""%JAVA_HOME%"" == """" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist ""%JAVA_HOME%\bin\java.exe"" goto chkMHome
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = ""%JAVA_HOME%"" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
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
:stripMHome
if not ""_%M2_HOME:~-1%""==""_\"" goto checkMCmd
set ""M2_HOME=%M2_HOME:~0,-1%""
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 ====
:init
set MAVEN_CMD_LINE_ARGS=%*
@REM Find the project base dir, i.e. the directory that contains the folder "".mvn"".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT ""%MAVEN_PROJECTBASEDIR%""=="""" goto endDetectBaseDir