Skip to content

Commit 34523db

Browse files
authored
update maven wrapper (#1936)
1 parent 84a4e36 commit 34523db

File tree

4 files changed

+253
-223
lines changed

4 files changed

+253
-223
lines changed

Diff for: .mvn/wrapper/maven-wrapper.jar

-1.17 KB
Binary file not shown.

Diff for: .mvn/wrapper/maven-wrapper.properties

+5-5
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-
# https://www.apache.org/licenses/LICENSE-2.0
10-
#
8+
#
9+
# http://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.
17-
distributionUrl=https://maven-central.storage-download.googleapis.com/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
18-
wrapperUrl=https://maven-central.storage-download.googleapis.com/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-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

Diff for: mvnw

100644100755
+60-31
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
# ----------------------------------------------------------------------------
2020

2121
# ----------------------------------------------------------------------------
22-
# Apache Maven Wrapper startup batch script, version 3.1.1
22+
# Maven Start Up Batch script
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
3031
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
3132
# e.g. to debug Maven itself, use
3233
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@@ -61,9 +62,9 @@ case "`uname`" in
6162
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
6263
if [ -z "$JAVA_HOME" ]; then
6364
if [ -x "/usr/libexec/java_home" ]; then
64-
JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME
65+
export JAVA_HOME="`/usr/libexec/java_home`"
6566
else
66-
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
67+
export JAVA_HOME="/Library/Java/Home"
6768
fi
6869
fi
6970
;;
@@ -75,8 +76,36 @@ if [ -z "$JAVA_HOME" ] ; then
7576
fi
7677
fi
7778

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+
78105
# For Cygwin, ensure paths are in UNIX format before anything is touched
79106
if $cygwin ; then
107+
[ -n "$M2_HOME" ] &&
108+
M2_HOME=`cygpath --unix "$M2_HOME"`
80109
[ -n "$JAVA_HOME" ] &&
81110
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
82111
[ -n "$CLASSPATH" ] &&
@@ -85,6 +114,8 @@ fi
85114

86115
# For Mingw, ensure paths are in UNIX format before anything is touched
87116
if $mingw ; then
117+
[ -n "$M2_HOME" ] &&
118+
M2_HOME="`(cd "$M2_HOME"; pwd)`"
88119
[ -n "$JAVA_HOME" ] &&
89120
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
90121
fi
@@ -132,9 +163,12 @@ if [ -z "$JAVA_HOME" ] ; then
132163
echo "Warning: JAVA_HOME environment variable is not set."
133164
fi
134165

166+
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
167+
135168
# traverses directory structure from process work directory to filesystem root
136169
# first directory with .mvn subdirectory is considered project base directory
137170
find_maven_basedir() {
171+
138172
if [ -z "$1" ]
139173
then
140174
echo "Path not specified to find_maven_basedir"
@@ -154,7 +188,7 @@ find_maven_basedir() {
154188
fi
155189
# end of workaround
156190
done
157-
printf '%s' "$(cd "$basedir"; pwd)"
191+
echo "${basedir}"
158192
}
159193

160194
# concatenates all lines of a file
@@ -164,16 +198,11 @@ concat_lines() {
164198
fi
165199
}
166200

167-
BASE_DIR=$(find_maven_basedir "$(dirname $0)")
201+
BASE_DIR=`find_maven_basedir "$(pwd)"`
168202
if [ -z "$BASE_DIR" ]; then
169203
exit 1;
170204
fi
171205

172-
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
173-
if [ "$MVNW_VERBOSE" = true ]; then
174-
echo $MAVEN_PROJECTBASEDIR
175-
fi
176-
177206
##########################################################################################
178207
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
179208
# This allows using the maven wrapper in projects that prohibit checking in binary data.
@@ -187,66 +216,59 @@ else
187216
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
188217
fi
189218
if [ -n "$MVNW_REPOURL" ]; then
190-
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
219+
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
191220
else
192-
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
221+
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
193222
fi
194223
while IFS="=" read key value; do
195-
case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
224+
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
196225
esac
197226
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
198227
if [ "$MVNW_VERBOSE" = true ]; then
199-
echo "Downloading from: $wrapperUrl"
228+
echo "Downloading from: $jarUrl"
200229
fi
201230
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
202231
if $cygwin; then
203232
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
204233
fi
205234

206235
if command -v wget > /dev/null; then
207-
QUIET="--quiet"
208236
if [ "$MVNW_VERBOSE" = true ]; then
209237
echo "Found wget ... using wget"
210-
QUIET=""
211238
fi
212239
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
213-
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath"
240+
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
214241
else
215-
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath"
242+
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
216243
fi
217-
[ $? -eq 0 ] || rm -f "$wrapperJarPath"
218244
elif command -v curl > /dev/null; then
219-
QUIET="--silent"
220245
if [ "$MVNW_VERBOSE" = true ]; then
221246
echo "Found curl ... using curl"
222-
QUIET=""
223247
fi
224248
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
225-
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L
249+
curl -o "$wrapperJarPath" "$jarUrl" -f
226250
else
227-
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L
251+
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
228252
fi
229-
[ $? -eq 0 ] || rm -f "$wrapperJarPath"
253+
230254
else
231255
if [ "$MVNW_VERBOSE" = true ]; then
232256
echo "Falling back to using Java to download"
233257
fi
234-
javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
235-
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class"
258+
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
236259
# For Cygwin, switch paths to Windows format before running javac
237260
if $cygwin; then
238-
javaSource=`cygpath --path --windows "$javaSource"`
239261
javaClass=`cygpath --path --windows "$javaClass"`
240262
fi
241-
if [ -e "$javaSource" ]; then
242-
if [ ! -e "$javaClass" ]; then
263+
if [ -e "$javaClass" ]; then
264+
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
243265
if [ "$MVNW_VERBOSE" = true ]; then
244266
echo " - Compiling MavenWrapperDownloader.java ..."
245267
fi
246268
# Compiling the Java class
247-
("$JAVA_HOME/bin/javac" "$javaSource")
269+
("$JAVA_HOME/bin/javac" "$javaClass")
248270
fi
249-
if [ -e "$javaClass" ]; then
271+
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
250272
# Running the downloader
251273
if [ "$MVNW_VERBOSE" = true ]; then
252274
echo " - Running MavenWrapperDownloader.java ..."
@@ -260,10 +282,16 @@ fi
260282
# End of extension
261283
##########################################################################################
262284

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

265291
# For Cygwin, switch paths to Windows format before running java
266292
if $cygwin; then
293+
[ -n "$M2_HOME" ] &&
294+
M2_HOME=`cygpath --path --windows "$M2_HOME"`
267295
[ -n "$JAVA_HOME" ] &&
268296
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
269297
[ -n "$CLASSPATH" ] &&
@@ -283,5 +311,6 @@ exec "$JAVACMD" \
283311
$MAVEN_OPTS \
284312
$MAVEN_DEBUG_OPTS \
285313
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
314+
"-Dmaven.home=${M2_HOME}" \
286315
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
287316
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

0 commit comments

Comments
 (0)