一、下载地址
http://maven.apache.org/download.cgi
二、把下载到的压缩包解压到相应目录
本机解压目录/Users/tangpy/automation/apache-maven-3.5.3
三、修改本地仓库存储路径(可不修改)
本机文件位置
/Users/tangpy/automation/apache-maven-3.5.3/conf/settings.xml
修改settings.xml文件中如下部分,修改成自己想要的路径
<localRepository>/Users/tangpy/automation/Repositories/Maven</localRepository>
四、配置环境变量(vi ~/.bash_profile)
在 ~/.bash_profile 中添加:
export M2_HOME=/Users/tangpy/automation/apache-maven-3.5.3
export PATH=$PATH:$M2_HOME/bin
五、验证是否生效
maven需要java环境,若未安装请看 Mac-Java环境配置
输入mvn -v,如下显示说明配置成功
tangpy:~ tangpy$ mvn -v
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00)
Maven home: /Users/tangpy/automation/apache-maven-3.5.3
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.5", arch: "x86_64", family: "mac"
网友评论