一 下载maven
http://maven.apache.org/download.cgi
选择zip下载即可。

二 配置maven
1.打开终端,查看是否有.bash_profile文件(如果没有就创建)
touch ~/.bash_profile
2.编辑文件
vi ~/.bash_profile
3.输入i进入插入模式:
输入maven(解压后的)所在的目录
export M2_HOME=/Users/ilim/Desktop/Development/apache-maven-3.5.2
export PATH=$PATH:$M2_HOME/bin
4.强制执行文件:source ~/.bash_profile
三 测试maven
1.在终端输入
mvn -v
2.显示 apache 信息

四 仓库配置
自从开源中国的maven仓库挂了之后就一直在用国外的仓库,慢得想要砸电脑的心都有了。如果你和我一样受够了国外maven仓库的龟速下载?快试试阿里云提供的maven仓库,从此不在浪费生命……
仓库地址:http://maven.aliyun.com/nexus/#view-repositories;public~browsestorage
1.在maven的settings.xml文件里的mirrors节点,添加如下子节点:

2.或者直接在profiles->profile->repositories节点,添加如下子节点:

3.settings文件的路径
settings.xml的默认路径就:个人目录/.m2/settings.xml
如:
windowns:C:\Users\你的用户名\.m2\settings.xml
linux:/home/你的用户名/.m2/settings.xml
网友评论