I finally got maven installed, and the steps were generally easy, but I stepped in a few holes, I’ll record them.

Download APache Maven

Website📡: Apache-Maven

Choose Binary zip archive and download it.

Unzip the zip archive

I unzip it into /Libaray on my computer.

Configuration

vi .bash_profile

Add 2 lines into this profile

export M2_HOME=/Library/apache-maven-3.8.7 // Or you can choose your own path and folder
export PATH=$PATH:$M2_HOME/bin

Then, type :wq, save and quit vim.

Check if it is successful

(base) ******** ~ % mvn -verison

//If terminal output like this, congratulations!

Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Maven home: /Library/apache-maven-3.8.7
Java version: 1.8.0_301, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre
Default locale: en_GB, platform encoding: UTF-8

Some problem

Sometimes, it reports error that it could not find JAVAHOME. It is probably that the JAVA_HOME in the computer is wrong.

Type command below to check jdk version

where java

Terminal would output a path if you do have java on the computer, then copy this command and type command below

vi .bash_profile

Replace the path in JAVA_HOME with your copies, then :wq, finally

source .bash_profile

mvn -version