maven官网下载
点击download
![](https://img-blog.csdnimg.cn/img_convert/68d19e4e5a154cccda8040baaa6ebe78.png)
如果需要下载历史版本,点击archives
![](https://img-blog.csdnimg.cn/img_convert/c71a302767635a660601f56b7025fe42.png)
选择需要的历史版本后,进入binaries
![](https://img-blog.csdnimg.cn/img_convert/0161492663160e8f3b3d85bb9488f7ee.png)
![](https://img-blog.csdnimg.cn/img_convert/3fd6e2acbf905322fa0d4bb5fac5d6ba.png)
配置maven环境变量
解压
打开终端,提升权限: sudo su,输入开机密码
![](https://img-blog.csdnimg.cn/img_convert/8a43e3ce91dc2a139f10f76d8546c112.png)
编辑.bash_profile : vi .bash_profile,配置下载好的maven文件路径
如果没有.bash_profile文件,在对应的用户文件夹下创建此文件
![](https://img-blog.csdnimg.cn/img_convert/08085ebfe202b972eb797cf55ac13943.png)
export M2_HOME=/Users/jinlf/design_by_jlf/software_space/apache-maven-3.6.2
export PATH=${PATH}:${M2_HOME}/bin
保存退出并执行
:wq
source .bash_profile
测试是否配置成功: mvn -v
![](https://img-blog.csdnimg.cn/img_convert/190f1c1b739211cc9dfe77ed422ab32b.png)
配置settings
修改本地仓库位置
![](https://img-blog.csdnimg.cn/img_convert/e14660a385bdde2173167ad025197693.png)
添加阿里maven镜像服务器作为远程仓库
![](https://img-blog.csdnimg.cn/img_convert/49f778e1435a5ad4040415bd975a95b2.png)