1、从maven官网下载最新maven库http://maven.apache.org/download.html,我下载是apache-maven-3.2.1(如果有安裝XCode, XCode会自动帮你安裝Maven, 安裝在/usr/share/java/)
2、把下载好的文件apache-maven-3.2.1放到指定目录/Volumes/work/dev/maven下,不推荐放到系统目录
3、启动终端Terminal并 进入当前用户的home目录 输入命令cd ~
4、创建.bash_profile 输入命令touch .bash_profile
5、编辑.bash_profile文件 输入命令open -e .bash_profile .bash_profile 文件添加一下内容:
export M2_HOME=/Volumes/work/dev/maven/apache-maven-3.2.1
export PATH=$M2_HOME/bin:$PATH
6、 保存文件,关闭.bash_profile
6. 更新刚配置的环境变量
输入命令source .bash_profile
7、验证:输入adb回车。如果未显示command not found,说明此命令有效,环境便亮设置完成
8、intellij idea已经集成maven插件,intellij配置maven环境如下图: