下载Maven
下载地址 : https://maven.apache.org/download.cgi
解压zip包到指定目录
例如:
/Users/Walid/Desktop/develop/tools/apache-maven-3.3.9/
环境变量配置
打开Terminal,设置Maven classpath
vim ~/.bash_profile
- 1
- 1
加入以下配置:
export M2_HOME=/Users/Walid/Desktop/develop/tools/apache-maven-3.3.9/
export PATH=$PATH:$M2_HOME/bin
- 1
- 2
- 1
- 2
使bash_profile生效
source ~/.bash_profile
- 1
- 1
验证Maven
mvn -v
- 1
- 1
如果看到如下log信息,代表安装成功~
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /Users/Walid/Desktop/develop/tools/apache-maven-3.3.9
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.1", arch: "x86_64", family: "mac"