7
7
@ REM "License"); you may not use this file except in compliance
8
8
@ REM with the License. You may obtain a copy of the License at
9
9
@ REM
10
- @ REM https ://www.apache.org/licenses/LICENSE-2.0
10
+ @ REM http ://www.apache.org/licenses/LICENSE-2.0
11
11
@ REM
12
12
@ REM Unless required by applicable law or agreed to in writing,
13
13
@ REM software distributed under the License is distributed on an
18
18
@ REM ----------------------------------------------------------------------------
19
19
20
20
@ REM ----------------------------------------------------------------------------
21
- @ REM Maven2 Start Up Batch script
21
+ @ REM Maven Start Up Batch script
22
22
@ REM
23
23
@ REM Required ENV vars:
24
24
@ REM JAVA_HOME - location of a JDK home dir
25
25
@ REM
26
26
@ REM Optional ENV vars
27
27
@ REM M2_HOME - location of maven2's installed home dir
28
28
@ REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29
- @ REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
29
+ @ REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
30
30
@ REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31
31
@ REM e.g. to debug Maven itself, use
32
32
@ REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
37
37
@ echo off
38
38
@ REM set title of command window
39
39
title %0
40
- @ REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
40
+ @ REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
41
41
@ if " %MAVEN_BATCH_ECHO% " == " on" echo %MAVEN_BATCH_ECHO%
42
42
43
43
@ REM set %HOME% to equivalent of $HOME
@@ -120,7 +120,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120
120
set WRAPPER_JAR = " %MAVEN_PROJECTBASEDIR% \.mvn\wrapper\maven-wrapper.jar"
121
121
set WRAPPER_LAUNCHER = org.apache.maven.wrapper.MavenWrapperMain
122
122
123
- set DOWNLOAD_URL = " https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3 /maven-wrapper-0.5.3 .jar"
123
+ set DOWNLOAD_URL = " https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6 /maven-wrapper-0.5.6 .jar"
124
124
125
125
FOR /F " tokens=1,2 delims==" %%A IN (" %MAVEN_PROJECTBASEDIR% \.mvn\wrapper\maven-wrapper.properties" ) DO (
126
126
IF " %%A " == " wrapperUrl" SET DOWNLOAD_URL = %%B
@@ -129,25 +129,35 @@ FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-
129
129
@ REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130
130
@ REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131
131
if exist %WRAPPER_JAR% (
132
- echo Found %WRAPPER_JAR%
132
+ if " %MVNW_VERBOSE% " == " true" (
133
+ echo Found %WRAPPER_JAR%
134
+ )
133
135
) else (
134
- if not " %MVNW_REPOURL% " == " " (
135
- SET DOWNLOAD_URL = " %MVNW_REPOURL% /io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"
136
- )
137
- echo Couldn't find %WRAPPER_JAR% , downloading it ...
138
- echo Downloading from: %DOWNLOAD_URL%
139
-
136
+ if not " %MVNW_REPOURL% " == " " (
137
+ SET DOWNLOAD_URL = " %MVNW_REPOURL% /io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
138
+ )
139
+ if " %MVNW_VERBOSE% " == " true" (
140
+ echo Couldn't find %WRAPPER_JAR% , downloading it ...
141
+ echo Downloading from: %DOWNLOAD_URL%
142
+ )
143
+
140
144
powershell -Command " &{" ^
141
145
" $webclient = new-object System.Net.WebClient;" ^
142
146
" if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME% ') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD% '))) {" ^
143
147
" $webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME% ', '%MVNW_PASSWORD% ');" ^
144
148
" }" ^
145
149
" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL% ', '%WRAPPER_JAR% ')" ^
146
150
" }"
147
- echo Finished downloading %WRAPPER_JAR%
151
+ if " %MVNW_VERBOSE% " == " true" (
152
+ echo Finished downloading %WRAPPER_JAR%
153
+ )
148
154
)
149
155
@ REM End of extension
150
156
157
+ @ REM Provide a "standardized" way to retrieve the CLI args that will
158
+ @ REM work with both Windows and non-Windows executions.
159
+ set MAVEN_CMD_LINE_ARGS = %*
160
+
151
161
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% " -Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR% " %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
152
162
if ERRORLEVEL 1 goto error
153
163
goto end
0 commit comments