Skip to content

Commit c0101de

Browse files
srowendongjoon-hyun
authored andcommitted
[SPARK-28963][BUILD] Fall back to archive.apache.org in build/mvn for older releases
### What changes were proposed in this pull request? Fall back to archive.apache.org in `build/mvn` to download Maven, in case the ASF mirrors no longer have an older release. ### Why are the changes needed? If an older release's specified Maven doesn't exist in the mirrors, {{build/mvn}} will fail. ### Does this PR introduce any user-facing change? No ### How was this patch tested? Manually tested different paths and failures by commenting in/out parts of the script and modifying it directly. Closes #25667 from srowen/SPARK-28963. Authored-by: Sean Owen <[email protected]> Signed-off-by: HyukjinKwon <[email protected]> (cherry picked from commit df39855) Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 3d334ac commit c0101de

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

build/mvn

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ 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+
# Fall back to archive.apache.org for older Maven
88+
echo "Falling back to archive.apache.org to download Maven"
89+
APACHE_MIRROR="https://archive.apache.org/dist"
90+
fi
91+
fi
8392

8493
install_app \
8594
"${APACHE_MIRROR}/maven/maven-3/${MVN_VERSION}/binaries" \

0 commit comments

Comments
 (0)