1. Download maven
Open Maven official website download page: http://maven.apache.org/download.cgi
Download: apache-maven-3.5.0-bin.tar.gz
Unzip the downloaded installation package to a directory, for example:/users/xxx/documents/maven
2. Configure Environment variables
- Open Terminel to enter the following command:
vim ~/.bash_profile
To open a. bash_profile file, add a command to set environment variables in the secondary file
export M2_HOME=/Users/xxx/Documents/maven/apache-maven-3.5.0
export PATH=$PATH:$M2_HOME/bin
After the addition is saved and launched, execute the following command to make the configuration effective:
SOURCE ~/.bash_profile
3. Check if the configuration is in effect
1, enter: Mvn-v command, enter as follows:
Apache Maven3.5.0(ff8f5e7444045639af65f6095c62210b5713f426; .-Geneva-04t03: the: .+ ,:xx) Maven Home:/users/xxx/documents/maven/apache-maven-3.5.0Java Version:1.8. 0_121, Vendor:oracle Corporationjava home:/library/java/javavirtualmachines/jdk1.8.0_121.jdk/contents/home/Jredefault LOCALE:ZH_CN, platform Encoding:utf-8OS Name:"Mac OS X", Version:"10.12.6", Arch:"x86_64", Family:"mac"
The configuration succeeds.
Installing and configuring Maven under Mac OS x