Skip to content

Commit 158d91b

Browse files
committed
Fall back to archive.apache.org in build/mvn for older releases
1 parent 94e6674 commit 158d91b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

build/mvn

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ install_mvn() {
8080
fi
8181
if [ $(version $MVN_DETECTED_VERSION) -lt $(version $MVN_VERSION) ]; then
8282
local APACHE_MIRROR=${APACHE_MIRROR:-'https://www.apache.org/dyn/closer.lua?action=download&filename='}
83+
84+
if [ $(command -v curl) ]; then
85+
local TEST_MIRROR_URL="${APACHE_MIRROR}/maven/maven-3/${MVN_VERSION}/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz"
86+
if curl -L --output /dev/null --silent --head --fail "$TEST_MIRROR_URL" ; then
87+
echo "Found Maven at $TEST_MIRROR_URL"
88+
else
89+
# Fall back to archive.apache.org for older Maven
90+
echo "Falling back to archive.apache.org to download Maven"
91+
APACHE_MIRROR="https://archive.apache.org/dist"
92+
fi
93+
fi
8394

8495
install_app \
8596
"${APACHE_MIRROR}/maven/maven-3/${MVN_VERSION}/binaries" \

0 commit comments

Comments
 (0)