LuciferYang commented on code in PR #47706:
URL: https://github.com/apache/spark/pull/47706#discussion_r1713193584


##########
build/mvn:
##########
@@ -115,34 +110,37 @@ function version { echo "$@" | awk -F. '{ 
printf("%03d%03d%03d\n", $1,$2,$3); }'
 # install maven under the build/ folder if needed.
 install_mvn() {
   local MVN_VERSION=`grep "<maven.version>" "${_DIR}/../pom.xml" | head -n1 | 
awk -F '[<>]' '{print $3}'`
-  MVN_BIN="$(command -v mvn)"
-  if [ "$MVN_BIN" ]; then
-    local MVN_DETECTED_VERSION="$(mvn --version | head -n1 | awk '{print $3}')"
-  fi
-  if [ $(version $MVN_DETECTED_VERSION) -ne $(version $MVN_VERSION) ]; then
-    local MVN_TARBALL="apache-maven-${MVN_VERSION}-bin.tar.gz"
-    local FILE_PATH="maven/maven-3/${MVN_VERSION}/binaries/${MVN_TARBALL}"
-    local 
APACHE_MIRROR=${APACHE_MIRROR:-'https://www.apache.org/dyn/closer.lua'}
-    local MIRROR_URL_QUERY="?action=download"
-
-    if [ $(command -v curl) ]; then
-      if ! curl -L --output /dev/null --silent --head --fail 
"${APACHE_MIRROR}/${FILE_PATH}${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
+  MVN_BIN="${_DIR}/apache-maven-${MVN_VERSION}/bin/mvn"

Review Comment:
   ```
   MVN_BIN="${_DIR}/apache-maven-${MVN_VERSION}/bin/mvn"
   if [ -f "$MVN_BIN" ]; then
     return
   fi
   ```
   
   Is it feasible to change it to check if `$MVN_BIN` exists and return 
directly ? This way, it seems that we won't need to modify those indentations.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to