123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- @echo off
- title %0
- @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
- if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
- if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
- 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
- @setlocal
- 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 init
- 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
- :init
- set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
- IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
- set EXEC_DIR=%CD%
- set WDIR=%EXEC_DIR%
- :findBaseDir
- IF EXIST "%WDIR%"\.mvn goto baseDirFound
- cd ..
- IF "%WDIR%"=="%CD%" goto baseDirNotFound
- set WDIR=%CD%
- goto findBaseDir
- :baseDirFound
- set MAVEN_PROJECTBASEDIR=%WDIR%
- cd "%EXEC_DIR%"
- goto endDetectBaseDir
- :baseDirNotFound
- set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
- cd "%EXEC_DIR%"
- :endDetectBaseDir
- IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
- @setlocal EnableExtensions EnableDelayedExpansion
- for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
- @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
- :endReadAdditionalConfig
- SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
- set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
- set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
- set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
- )
- if exist %WRAPPER_JAR% (
- if "%MVNW_VERBOSE%" == "true" (
- echo Found %WRAPPER_JAR%
- )
- ) else (
- if not "%MVNW_REPOURL%" == "" (
- SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- )
- if "%MVNW_VERBOSE%" == "true" (
- echo Couldn't find %WRAPPER_JAR%, downloading it ...
- echo Downloading from: %DOWNLOAD_URL%
- )
- powershell -Command "&{"^
- "$webclient = new-object System.Net.WebClient;"^
- "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
- "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
- "}"^
- "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
- "}"
- if "%MVNW_VERBOSE%" == "true" (
- echo Finished downloading %WRAPPER_JAR%
- )
- )
- set MAVEN_CMD_LINE_ARGS=%*
- %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
- if ERRORLEVEL 1 goto error
- goto end
- :error
- set ERROR_CODE=1
- :end
- @endlocal & set ERROR_CODE=%ERROR_CODE%
- if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
- if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
- if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
- :skipRcPost
- if "%MAVEN_BATCH_PAUSE%" == "on" pause
- if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
- exit /B %ERROR_CODE%
|