Skip to content

Commit cbdc89d

Browse files
committed
Update maven wrapper
1 parent 0875cab commit cbdc89d

File tree

2 files changed

+35
-64
lines changed

2 files changed

+35
-64
lines changed

.mvn/wrapper/maven-wrapper.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
# to you under the Apache License, Version 2.0 (the
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
18-
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

mvnw

Lines changed: 31 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919
# ----------------------------------------------------------------------------
2020

2121
# ----------------------------------------------------------------------------
22-
# Maven Start Up Batch script
22+
# Apache Maven Wrapper startup batch script, version 3.1.1
2323
#
2424
# Required ENV vars:
2525
# ------------------
2626
# JAVA_HOME - location of a JDK home dir
2727
#
2828
# Optional ENV vars
2929
# -----------------
30-
# M2_HOME - location of maven2's installed home dir
3130
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
3231
# e.g. to debug Maven itself, use
3332
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@@ -62,9 +61,9 @@ case "`uname`" in
6261
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
6362
if [ -z "$JAVA_HOME" ]; then
6463
if [ -x "/usr/libexec/java_home" ]; then
65-
export JAVA_HOME="`/usr/libexec/java_home`"
64+
JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME
6665
else
67-
export JAVA_HOME="/Library/Java/Home"
66+
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
6867
fi
6968
fi
7069
;;
@@ -76,36 +75,8 @@ if [ -z "$JAVA_HOME" ] ; then
7675
fi
7776
fi
7877

79-
if [ -z "$M2_HOME" ] ; then
80-
## resolve links - $0 may be a link to maven's home
81-
PRG="$0"
82-
83-
# need this for relative symlinks
84-
while [ -h "$PRG" ] ; do
85-
ls=`ls -ld "$PRG"`
86-
link=`expr "$ls" : '.*-> \(.*\)$'`
87-
if expr "$link" : '/.*' > /dev/null; then
88-
PRG="$link"
89-
else
90-
PRG="`dirname "$PRG"`/$link"
91-
fi
92-
done
93-
94-
saveddir=`pwd`
95-
96-
M2_HOME=`dirname "$PRG"`/..
97-
98-
# make it fully qualified
99-
M2_HOME=`cd "$M2_HOME" && pwd`
100-
101-
cd "$saveddir"
102-
# echo Using m2 at $M2_HOME
103-
fi
104-
10578
# For Cygwin, ensure paths are in UNIX format before anything is touched
10679
if $cygwin ; then
107-
[ -n "$M2_HOME" ] &&
108-
M2_HOME=`cygpath --unix "$M2_HOME"`
10980
[ -n "$JAVA_HOME" ] &&
11081
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
11182
[ -n "$CLASSPATH" ] &&
@@ -114,8 +85,6 @@ fi
11485

11586
# For Mingw, ensure paths are in UNIX format before anything is touched
11687
if $mingw ; then
117-
[ -n "$M2_HOME" ] &&
118-
M2_HOME="`(cd "$M2_HOME"; pwd)`"
11988
[ -n "$JAVA_HOME" ] &&
12089
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
12190
fi
@@ -163,12 +132,9 @@ if [ -z "$JAVA_HOME" ] ; then
163132
echo "Warning: JAVA_HOME environment variable is not set."
164133
fi
165134

166-
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
167-
168135
# traverses directory structure from process work directory to filesystem root
169136
# first directory with .mvn subdirectory is considered project base directory
170137
find_maven_basedir() {
171-
172138
if [ -z "$1" ]
173139
then
174140
echo "Path not specified to find_maven_basedir"
@@ -188,7 +154,7 @@ find_maven_basedir() {
188154
fi
189155
# end of workaround
190156
done
191-
echo "${basedir}"
157+
printf '%s' "$(cd "$basedir"; pwd)"
192158
}
193159

194160
# concatenates all lines of a file
@@ -198,11 +164,16 @@ concat_lines() {
198164
fi
199165
}
200166

201-
BASE_DIR=`find_maven_basedir "$(pwd)"`
167+
BASE_DIR=$(find_maven_basedir "$(dirname $0)")
202168
if [ -z "$BASE_DIR" ]; then
203169
exit 1;
204170
fi
205171

172+
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
173+
if [ "$MVNW_VERBOSE" = true ]; then
174+
echo $MAVEN_PROJECTBASEDIR
175+
fi
176+
206177
##########################################################################################
207178
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
208179
# This allows using the maven wrapper in projects that prohibit checking in binary data.
@@ -216,59 +187,66 @@ else
216187
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
217188
fi
218189
if [ -n "$MVNW_REPOURL" ]; then
219-
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
190+
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
220191
else
221-
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
192+
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
222193
fi
223194
while IFS="=" read key value; do
224-
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
195+
case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
225196
esac
226197
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
227198
if [ "$MVNW_VERBOSE" = true ]; then
228-
echo "Downloading from: $jarUrl"
199+
echo "Downloading from: $wrapperUrl"
229200
fi
230201
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
231202
if $cygwin; then
232203
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
233204
fi
234205

235206
if command -v wget > /dev/null; then
207+
QUIET="--quiet"
236208
if [ "$MVNW_VERBOSE" = true ]; then
237209
echo "Found wget ... using wget"
210+
QUIET=""
238211
fi
239212
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
240-
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
213+
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath"
241214
else
242-
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
215+
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath"
243216
fi
217+
[ $? -eq 0 ] || rm -f "$wrapperJarPath"
244218
elif command -v curl > /dev/null; then
219+
QUIET="--silent"
245220
if [ "$MVNW_VERBOSE" = true ]; then
246221
echo "Found curl ... using curl"
222+
QUIET=""
247223
fi
248224
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
249-
curl -o "$wrapperJarPath" "$jarUrl" -f
225+
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L
250226
else
251-
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
227+
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L
252228
fi
253-
229+
[ $? -eq 0 ] || rm -f "$wrapperJarPath"
254230
else
255231
if [ "$MVNW_VERBOSE" = true ]; then
256232
echo "Falling back to using Java to download"
257233
fi
258-
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
234+
javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
235+
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class"
259236
# For Cygwin, switch paths to Windows format before running javac
260237
if $cygwin; then
238+
javaSource=`cygpath --path --windows "$javaSource"`
261239
javaClass=`cygpath --path --windows "$javaClass"`
262240
fi
263-
if [ -e "$javaClass" ]; then
264-
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
241+
if [ -e "$javaSource" ]; then
242+
if [ ! -e "$javaClass" ]; then
265243
if [ "$MVNW_VERBOSE" = true ]; then
266244
echo " - Compiling MavenWrapperDownloader.java ..."
267245
fi
268246
# Compiling the Java class
269-
("$JAVA_HOME/bin/javac" "$javaClass")
247+
("$JAVA_HOME/bin/javac" "$javaSource")
270248
fi
271-
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
249+
if [ -e "$javaClass" ]; then
272250
# Running the downloader
273251
if [ "$MVNW_VERBOSE" = true ]; then
274252
echo " - Running MavenWrapperDownloader.java ..."
@@ -282,16 +260,10 @@ fi
282260
# End of extension
283261
##########################################################################################
284262

285-
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
286-
if [ "$MVNW_VERBOSE" = true ]; then
287-
echo $MAVEN_PROJECTBASEDIR
288-
fi
289263
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
290264

291265
# For Cygwin, switch paths to Windows format before running java
292266
if $cygwin; then
293-
[ -n "$M2_HOME" ] &&
294-
M2_HOME=`cygpath --path --windows "$M2_HOME"`
295267
[ -n "$JAVA_HOME" ] &&
296268
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
297269
[ -n "$CLASSPATH" ] &&
@@ -311,6 +283,5 @@ exec "$JAVACMD" \
311283
$MAVEN_OPTS \
312284
$MAVEN_DEBUG_OPTS \
313285
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
314-
"-Dmaven.home=${M2_HOME}" \
315286
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
316287
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

0 commit comments

Comments
 (0)