Skip to content

Commit 7e8d914

Browse files
authored
[MWRAPPER-47] Use name wrapperUrl consistently in Maven Wrapper scripts (#14)
refactor: Replaced jarUrl with wrapperUrl in mvnw refactor: Replaced DOWNLOAD_URL with WRAPPER_URL in mvnw.cmd
1 parent efba2bd commit 7e8d914

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

maven-wrapper-distribution/src/resources/mvnw

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,16 @@ else
216216
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
217217
fi
218218
if [ -n "$MVNW_REPOURL" ]; then
219-
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/@project.version@/maven-wrapper-@project.version@.jar"
219+
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/@project.version@/maven-wrapper-@project.version@.jar"
220220
else
221-
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@project.version@/maven-wrapper-@project.version@.jar"
221+
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@project.version@/maven-wrapper-@project.version@.jar"
222222
fi
223223
while IFS="=" read key value; do
224-
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
224+
case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
225225
esac
226226
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
227227
if [ "$MVNW_VERBOSE" = true ]; then
228-
echo "Downloading from: $jarUrl"
228+
echo "Downloading from: $wrapperUrl"
229229
fi
230230
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
231231
if $cygwin; then
@@ -239,9 +239,9 @@ else
239239
QUIET=""
240240
fi
241241
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
242-
wget $QUIET "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
242+
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
243243
else
244-
wget $QUIET --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
244+
wget $QUIET --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
245245
fi
246246
elif command -v curl > /dev/null; then
247247
QUIET="--silent"
@@ -250,9 +250,9 @@ else
250250
QUIET=""
251251
fi
252252
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
253-
curl $QUIET -o "$wrapperJarPath" "$jarUrl" -f
253+
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f
254254
else
255-
curl $QUIET --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
255+
curl $QUIET --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$wrapperUrl" -f
256256
fi
257257

258258
else

maven-wrapper-distribution/src/resources/mvnw.cmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120120
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121121
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122122

123-
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@project.version@/maven-wrapper-@project.version@.jar"
123+
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@project.version@/maven-wrapper-@project.version@.jar"
124124

125125
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126-
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
126+
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
127127
)
128128

129129
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@@ -134,19 +134,19 @@ if exist %WRAPPER_JAR% (
134134
)
135135
) else (
136136
if not "%MVNW_REPOURL%" == "" (
137-
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/@project.version@/maven-wrapper-@project.version@.jar"
137+
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/@project.version@/maven-wrapper-@project.version@.jar"
138138
)
139139
if "%MVNW_VERBOSE%" == "true" (
140140
echo Couldn't find %WRAPPER_JAR%, downloading it ...
141-
echo Downloading from: %DOWNLOAD_URL%
141+
echo Downloading from: %WRAPPER_URL%
142142
)
143143

144144
powershell -Command "&{"^
145145
"$webclient = new-object System.Net.WebClient;"^
146146
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147147
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148148
"}"^
149-
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
149+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
150150
"}"
151151
if "%MVNW_VERBOSE%" == "true" (
152152
echo Finished downloading %WRAPPER_JAR%

0 commit comments

Comments
 (0)