1、从maven官网下载apache-maven-3.5.0-bin.tar.gz,解压到指定的路径下。
2、在root权限下执行:
vim /etc/profile
添加(为maven配置环境变量):
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export M2_HOME=/usr/local/apache-maven-3.5.0
3、执行:
source /etc/profile
使得环境变量文件生效。
4、打开eclipse,在window——>preferences内:
(1)找到maven——>installations,点击add,添加maven的安装路径;
(2)在User Settings内,将global settings/user settings配置为…/apache-maven-3.5.0/conf/settings.xml(即maven安装路径下找到settings.xml文件);
5、完美。