8
8
# "License"); you may not use this file except in compliance
9
9
# with the License. You may obtain a copy of the License at
10
10
#
11
- # https ://www.apache.org/licenses/LICENSE-2.0
11
+ # http ://www.apache.org/licenses/LICENSE-2.0
12
12
#
13
13
# Unless required by applicable law or agreed to in writing,
14
14
# software distributed under the License is distributed on an
19
19
# ----------------------------------------------------------------------------
20
20
21
21
# ----------------------------------------------------------------------------
22
- # Apache Maven Wrapper startup batch script, version 3.3.2
22
+ # Apache Maven Wrapper startup batch script, version 3.3.3
23
23
#
24
24
# Required ENV vars:
25
25
# ------------------
@@ -201,6 +201,14 @@ MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
201
201
export MAVEN_PROJECTBASEDIR
202
202
log " $MAVEN_PROJECTBASEDIR "
203
203
204
+ trim () {
205
+ # MWRAPPER-139:
206
+ # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
207
+ # Needed for removing poorly interpreted newline sequences when running in more
208
+ # exotic environments such as mingw bash on Windows.
209
+ printf " %s" " ${1} " | tr -d ' [:space:]'
210
+ }
211
+
204
212
# #########################################################################################
205
213
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
206
214
# This allows using the maven wrapper in projects that prohibit checking in binary data.
@@ -212,15 +220,13 @@ else
212
220
log " Couldn't find $wrapperJarPath , downloading it ..."
213
221
214
222
if [ -n " $MVNW_REPOURL " ]; then
215
- wrapperUrl=" $MVNW_REPOURL /org/apache/maven/wrapper/maven-wrapper/3.3.2 /maven-wrapper-3.3.2 .jar"
223
+ wrapperUrl=" $MVNW_REPOURL /org/apache/maven/wrapper/maven-wrapper/3.3.3 /maven-wrapper-3.3.3 .jar"
216
224
else
217
- wrapperUrl=" https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2 /maven-wrapper-3.3.2 .jar"
225
+ wrapperUrl=" https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.3 /maven-wrapper-3.3.3 .jar"
218
226
fi
219
227
while IFS=" =" read -r key value; do
220
- # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
221
- safeValue=$( echo " $value " | tr -d ' \r' )
222
228
case " $key " in wrapperUrl)
223
- wrapperUrl=" $safeValue "
229
+ wrapperUrl=$( trim " ${value-} " )
224
230
break
225
231
;;
226
232
esac
@@ -235,17 +241,17 @@ else
235
241
log " Found wget ... using wget"
236
242
[ " $MVNW_VERBOSE " = true ] && QUIET=" " || QUIET=" --quiet"
237
243
if [ -z " $MVNW_USERNAME " ] || [ -z " $MVNW_PASSWORD " ]; then
238
- wget $QUIET " $wrapperUrl " -O " $wrapperJarPath " || rm -f " $wrapperJarPath "
244
+ wget ${ QUIET: + " $QUIET " } " $wrapperUrl " -O " $wrapperJarPath " || rm -f " $wrapperJarPath "
239
245
else
240
- wget $QUIET --http-user=" $MVNW_USERNAME " --http-password=" $MVNW_PASSWORD " " $wrapperUrl " -O " $wrapperJarPath " || rm -f " $wrapperJarPath "
246
+ wget ${ QUIET: + " $QUIET " } --http-user=" $MVNW_USERNAME " --http-password=" $MVNW_PASSWORD " " $wrapperUrl " -O " $wrapperJarPath " || rm -f " $wrapperJarPath "
241
247
fi
242
248
elif command -v curl > /dev/null; then
243
249
log " Found curl ... using curl"
244
250
[ " $MVNW_VERBOSE " = true ] && QUIET=" " || QUIET=" --silent"
245
251
if [ -z " $MVNW_USERNAME " ] || [ -z " $MVNW_PASSWORD " ]; then
246
- curl $QUIET -o " $wrapperJarPath " " $wrapperUrl " -f -L || rm -f " $wrapperJarPath "
252
+ curl ${ QUIET: + " $QUIET " } -o " $wrapperJarPath " " $wrapperUrl " -f -L || rm -f " $wrapperJarPath "
247
253
else
248
- curl $QUIET --user " $MVNW_USERNAME :$MVNW_PASSWORD " -o " $wrapperJarPath " " $wrapperUrl " -f -L || rm -f " $wrapperJarPath "
254
+ curl ${ QUIET: + " $QUIET " } --user " $MVNW_USERNAME :$MVNW_PASSWORD " -o " $wrapperJarPath " " $wrapperUrl " -f -L || rm -f " $wrapperJarPath "
249
255
fi
250
256
else
251
257
log " Falling back to using Java to download"
276
282
wrapperSha256Sum=" "
277
283
while IFS=" =" read -r key value; do
278
284
case " $key " in wrapperSha256Sum)
279
- wrapperSha256Sum=$value
285
+ wrapperSha256Sum=$( trim " ${ value-} " )
280
286
break
281
287
;;
282
288
esac
283
289
done < " $MAVEN_PROJECTBASEDIR /.mvn/wrapper/maven-wrapper.properties"
284
290
if [ -n " $wrapperSha256Sum " ]; then
285
291
wrapperSha256Result=false
286
292
if command -v sha256sum > /dev/null; then
287
- if echo " $wrapperSha256Sum $wrapperJarPath " | sha256sum -c > /dev/null 2>&1 ; then
293
+ if echo " $wrapperSha256Sum $wrapperJarPath " | sha256sum -c - > /dev/null 2>&1 ; then
288
294
wrapperSha256Result=true
289
295
fi
290
296
elif command -v shasum > /dev/null; then
0 commit comments