Skip to content

Commit 5169b16

Browse files
committed
Use Apache 'closer' service to obtain mirror host, instead of using (defunct?) filename= syntax
1 parent e8d6992 commit 5169b16

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

build/mvn

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ install_mvn() {
7171
local MVN_DETECTED_VERSION="$(mvn --version | head -n1 | awk '{print $3}')"
7272
fi
7373
if [ $(version $MVN_DETECTED_VERSION) -lt $(version $MVN_VERSION) ]; then
74-
local APACHE_MIRROR=${APACHE_MIRROR:-'https://www.apache.org/dyn/closer.lua?action=download&filename='}
75-
74+
local DEFAULT_APACHE_MIRROR=`curl --silent -X GET -I "https://www.apache.org/dyn/closer.lua?action=download" | grep "Location:" | cut -f2 -d' '| tr -d '\n' | tr -d '\r' | sed 's%^\(.*\)/$%\1%'`
75+
echo "Default Apache mirror is ${DEFAULT_APACHE_MIRROR}"
76+
local APACHE_MIRROR=${APACHE_MIRROR:-$DEFAULT_APACHE_MIRROR}
77+
echo "Trying mirror ${APACHE_MIRROR}"
78+
7679
if [ $(command -v curl) ]; then
7780
local TEST_MIRROR_URL="${APACHE_MIRROR}/maven/maven-3/${MVN_VERSION}/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz"
7881
if ! curl -L --output /dev/null --silent --head --fail "$TEST_MIRROR_URL" ; then

0 commit comments

Comments
 (0)