This is an automated email from the ASF dual-hosted git repository.
ethanfeng pushed a commit to branch branch-0.2
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git
The following commit(s) were added to refs/heads/branch-0.2 by this push:
new d1f30442f [CELEBORN-589][INFRA] Using Apache CDN to download maven
(#1492)
d1f30442f is described below
commit d1f30442f2cbf4a38a1821032670c768dedc313d
Author: Cheng Pan <[email protected]>
AuthorDate: Wed May 17 15:46:38 2023 +0800
[CELEBORN-589][INFRA] Using Apache CDN to download maven (#1492)
(cherry picked from commit 3cc296ef4fc66249575b0ceeb2ac1ad457114675)
---
build/mvn | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/build/mvn b/build/mvn
index 67aa02b4f..cd6c0c796 100755
--- a/build/mvn
+++ b/build/mvn
@@ -35,7 +35,7 @@ fi
## Arg2 - Tarball Name
## Arg3 - Checkable Binary
install_app() {
- local remote_tarball="$1/$2"
+ local remote_tarball="$1/$2$4"
local local_tarball="${_DIR}/$2"
local binary="${_DIR}/$3"
@@ -77,12 +77,25 @@ install_mvn() {
# See simple version normalization:
http://stackoverflow.com/questions/16989598/bash-comparing-version-numbers
function version { echo "$@" | awk -F. '{ printf("%03d%03d%03d\n",
$1,$2,$3); }'; }
if [ $(version $MVN_DETECTED_VERSION) -ne $(version $MVN_VERSION) ]; then
- local APACHE_MIRROR=${APACHE_MIRROR:-'https://archive.apache.org/dist/'}
+ local
APACHE_MIRROR=${APACHE_MIRROR:-'https://www.apache.org/dyn/closer.lua'}
+ local MIRROR_URL_QUERY="?action=download"
+ local MVN_TARBALL="apache-maven-${MVN_VERSION}-bin.tar.gz"
+ local FILE_PATH="maven/maven-3/${MVN_VERSION}/binaries"
+
+ if [ $(command -v curl) ]; then
+ if ! curl -L --output /dev/null --silent --head --fail
"${APACHE_MIRROR}/${FILE_PATH}/${MVN_TARBALL}${MIRROR_URL_QUERY}" ; then
+ # Fall back to archive.apache.org for older Maven
+ echo "Falling back to archive.apache.org to download Maven"
+ APACHE_MIRROR="https://archive.apache.org/dist"
+ MIRROR_URL_QUERY=""
+ fi
+ fi
install_app \
- "${APACHE_MIRROR}/maven/maven-3/${MVN_VERSION}/binaries" \
- "apache-maven-${MVN_VERSION}-bin.tar.gz" \
- "apache-maven-${MVN_VERSION}/bin/mvn"
+ "${APACHE_MIRROR}/${FILE_PATH}" \
+ "${MVN_TARBALL}" \
+ "apache-maven-${MVN_VERSION}/bin/mvn" \
+ "${MIRROR_URL_QUERY}"
MVN_BIN="${_DIR}/apache-maven-${MVN_VERSION}/bin/mvn"
fi