Skip to content

Commit 2255e1e

Browse files
committed
Update Maven Wrapper by running wrapper goal
Update Maven Wrapper by running wrapper goal. Furthermore, manually increase the version to 3.6.3 #293
1 parent 919c4bf commit 2255e1e

File tree

4 files changed

+239
-99
lines changed

4 files changed

+239
-99
lines changed

.mvn/wrapper/maven-wrapper.jar

12.7 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2010-2023. Axon Framework
2+
# Copyright (c) 2010-2024. Axon Framework
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -13,5 +13,5 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
17-
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip
16+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
17+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

mvnw

Lines changed: 160 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
#!/bin/sh
2-
# ----------------------------------------------------------------------------
3-
# Licensed to the Apache Software Foundation (ASF) under one
4-
# or more contributor license agreements. See the NOTICE file
5-
# distributed with this work for additional information
6-
# regarding copyright ownership. The ASF licenses this file
7-
# to you under the Apache License, Version 2.0 (the
8-
# "License"); you may not use this file except in compliance
9-
# with the License. You may obtain a copy of the License at
2+
#
3+
# Copyright (c) 2010-2024. Axon Framework
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
108
#
119
# http://www.apache.org/licenses/LICENSE-2.0
1210
#
13-
# Unless required by applicable law or agreed to in writing,
14-
# software distributed under the License is distributed on an
15-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16-
# KIND, either express or implied. See the License for the
17-
# specific language governing permissions and limitations
18-
# under the License.
19-
# ----------------------------------------------------------------------------
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
2017

2118
# ----------------------------------------------------------------------------
22-
# Maven2 Start Up Batch script
19+
# Apache Maven Wrapper startup batch script, version 3.2.0
2320
#
2421
# Required ENV vars:
2522
# ------------------
2623
# JAVA_HOME - location of a JDK home dir
2724
#
2825
# Optional ENV vars
2926
# -----------------
30-
# M2_HOME - location of maven2's installed home dir
3127
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
3228
# e.g. to debug Maven itself, use
3329
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@@ -36,6 +32,10 @@
3632

3733
if [ -z "$MAVEN_SKIP_RC" ] ; then
3834

35+
if [ -f /usr/local/etc/mavenrc ] ; then
36+
. /usr/local/etc/mavenrc
37+
fi
38+
3939
if [ -f /etc/mavenrc ] ; then
4040
. /etc/mavenrc
4141
fi
@@ -50,87 +50,56 @@ fi
5050
cygwin=false;
5151
darwin=false;
5252
mingw=false
53-
case "`uname`" in
53+
case "$(uname)" in
5454
CYGWIN*) cygwin=true ;;
5555
MINGW*) mingw=true;;
5656
Darwin*) darwin=true
5757
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
5858
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
5959
if [ -z "$JAVA_HOME" ]; then
6060
if [ -x "/usr/libexec/java_home" ]; then
61-
export JAVA_HOME="`/usr/libexec/java_home`"
61+
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
6262
else
63-
export JAVA_HOME="/Library/Java/Home"
63+
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
6464
fi
6565
fi
6666
;;
6767
esac
6868

6969
if [ -z "$JAVA_HOME" ] ; then
7070
if [ -r /etc/gentoo-release ] ; then
71-
JAVA_HOME=`java-config --jre-home`
71+
JAVA_HOME=$(java-config --jre-home)
7272
fi
7373
fi
7474

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

11183
# For Mingw, ensure paths are in UNIX format before anything is touched
11284
if $mingw ; then
113-
[ -n "$M2_HOME" ] &&
114-
M2_HOME="`(cd "$M2_HOME"; pwd)`"
115-
[ -n "$JAVA_HOME" ] &&
116-
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117-
# TODO classpath?
85+
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
86+
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
11887
fi
11988

12089
if [ -z "$JAVA_HOME" ]; then
121-
javaExecutable="`which javac`"
122-
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
90+
javaExecutable="$(which javac)"
91+
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
12392
# readlink(1) is not available as standard on Solaris 10.
124-
readLink=`which readlink`
125-
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
93+
readLink=$(which readlink)
94+
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
12695
if $darwin ; then
127-
javaHome="`dirname \"$javaExecutable\"`"
128-
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
96+
javaHome="$(dirname "\"$javaExecutable\"")"
97+
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
12998
else
130-
javaExecutable="`readlink -f \"$javaExecutable\"`"
99+
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
131100
fi
132-
javaHome="`dirname \"$javaExecutable\"`"
133-
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
101+
javaHome="$(dirname "\"$javaExecutable\"")"
102+
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
134103
JAVA_HOME="$javaHome"
135104
export JAVA_HOME
136105
fi
@@ -146,7 +115,7 @@ if [ -z "$JAVACMD" ] ; then
146115
JAVACMD="$JAVA_HOME/bin/java"
147116
fi
148117
else
149-
JAVACMD="`which java`"
118+
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
150119
fi
151120
fi
152121

@@ -160,12 +129,9 @@ if [ -z "$JAVA_HOME" ] ; then
160129
echo "Warning: JAVA_HOME environment variable is not set."
161130
fi
162131

163-
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
164-
165132
# traverses directory structure from process work directory to filesystem root
166133
# first directory with .mvn subdirectory is considered project base directory
167134
find_maven_basedir() {
168-
169135
if [ -z "$1" ]
170136
then
171137
echo "Path not specified to find_maven_basedir"
@@ -181,47 +147,159 @@ find_maven_basedir() {
181147
fi
182148
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
183149
if [ -d "${wdir}" ]; then
184-
wdir=`cd "$wdir/.."; pwd`
150+
wdir=$(cd "$wdir/.." || exit 1; pwd)
185151
fi
186152
# end of workaround
187153
done
188-
echo "${basedir}"
154+
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
189155
}
190156

191157
# concatenates all lines of a file
192158
concat_lines() {
193159
if [ -f "$1" ]; then
194-
echo "$(tr -s '\n' ' ' < "$1")"
160+
# Remove \r in case we run on Windows within Git Bash
161+
# and check out the repository with auto CRLF management
162+
# enabled. Otherwise, we may read lines that are delimited with
163+
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
164+
# splitting rules.
165+
tr -s '\r\n' ' ' < "$1"
195166
fi
196167
}
197168

198-
BASE_DIR=`find_maven_basedir "$(pwd)"`
169+
log() {
170+
if [ "$MVNW_VERBOSE" = true ]; then
171+
printf '%s\n' "$1"
172+
fi
173+
}
174+
175+
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
199176
if [ -z "$BASE_DIR" ]; then
200177
exit 1;
201178
fi
202179

203-
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
204-
if [ "$MVNW_VERBOSE" = true ]; then
205-
echo $MAVEN_PROJECTBASEDIR
180+
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
181+
log "$MAVEN_PROJECTBASEDIR"
182+
183+
##########################################################################################
184+
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
185+
# This allows using the maven wrapper in projects that prohibit checking in binary data.
186+
##########################################################################################
187+
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
188+
if [ -r "$wrapperJarPath" ]; then
189+
log "Found $wrapperJarPath"
190+
else
191+
log "Couldn't find $wrapperJarPath, downloading it ..."
192+
193+
if [ -n "$MVNW_REPOURL" ]; then
194+
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
195+
else
196+
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
197+
fi
198+
while IFS="=" read -r key value; do
199+
# 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 '=' )
200+
safeValue=$(echo "$value" | tr -d '\r')
201+
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
202+
esac
203+
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
204+
log "Downloading from: $wrapperUrl"
205+
206+
if $cygwin; then
207+
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
208+
fi
209+
210+
if command -v wget > /dev/null; then
211+
log "Found wget ... using wget"
212+
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
213+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
214+
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
215+
else
216+
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
217+
fi
218+
elif command -v curl > /dev/null; then
219+
log "Found curl ... using curl"
220+
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
221+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
222+
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
223+
else
224+
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
225+
fi
226+
else
227+
log "Falling back to using Java to download"
228+
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
229+
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
230+
# For Cygwin, switch paths to Windows format before running javac
231+
if $cygwin; then
232+
javaSource=$(cygpath --path --windows "$javaSource")
233+
javaClass=$(cygpath --path --windows "$javaClass")
234+
fi
235+
if [ -e "$javaSource" ]; then
236+
if [ ! -e "$javaClass" ]; then
237+
log " - Compiling MavenWrapperDownloader.java ..."
238+
("$JAVA_HOME/bin/javac" "$javaSource")
239+
fi
240+
if [ -e "$javaClass" ]; then
241+
log " - Running MavenWrapperDownloader.java ..."
242+
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
243+
fi
244+
fi
245+
fi
246+
fi
247+
##########################################################################################
248+
# End of extension
249+
##########################################################################################
250+
251+
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
252+
wrapperSha256Sum=""
253+
while IFS="=" read -r key value; do
254+
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
255+
esac
256+
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
257+
if [ -n "$wrapperSha256Sum" ]; then
258+
wrapperSha256Result=false
259+
if command -v sha256sum > /dev/null; then
260+
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
261+
wrapperSha256Result=true
262+
fi
263+
elif command -v shasum > /dev/null; then
264+
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
265+
wrapperSha256Result=true
266+
fi
267+
else
268+
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
269+
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
270+
exit 1
271+
fi
272+
if [ $wrapperSha256Result = false ]; then
273+
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
274+
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
275+
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
276+
exit 1
277+
fi
206278
fi
279+
207280
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
208281

209282
# For Cygwin, switch paths to Windows format before running java
210283
if $cygwin; then
211-
[ -n "$M2_HOME" ] &&
212-
M2_HOME=`cygpath --path --windows "$M2_HOME"`
213284
[ -n "$JAVA_HOME" ] &&
214-
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
285+
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
215286
[ -n "$CLASSPATH" ] &&
216-
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
287+
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
217288
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
218-
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
289+
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
219290
fi
220291

292+
# Provide a "standardized" way to retrieve the CLI args that will
293+
# work with both Windows and non-Windows executions.
294+
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
295+
export MAVEN_CMD_LINE_ARGS
296+
221297
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
222298

299+
# shellcheck disable=SC2086 # safe args
223300
exec "$JAVACMD" \
224301
$MAVEN_OPTS \
302+
$MAVEN_DEBUG_OPTS \
225303
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
226-
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
304+
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
227305
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

0 commit comments

Comments
 (0)