我正在浏览mvn.cmd脚本(在maven / bin中)注意到valMHome
未定义。
在旧的mvn.cmd (maven 3.3.3)
就像是,
: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
在最新的mvn.cmd文件(maven 3.5.2)
中就像是,
:chkMHome
set "MAVEN_HOME=%~dp0.."
if not "%MAVEN_HOME%"=="" goto valMHome
goto error
:valMHome
:stripMHome
if not "_%MAVEN_HOME:~-1%"=="_\" goto checkMCmd
set "MAVEN_HOME=%MAVEN_HOME:~0,-1%"
goto stripMHome
知道这些脚本中valMHome
的作用和用途是什么?