Mac OS X安装Maven

在官网下载Maven后解压放到任意目录,然后使用Vim编辑环境变量文件

$ vim ~/.bash_profile

在下方加入以下代码

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
export M2_HOME=/Users/amadeus/apache-maven-3.5.0
export PATH=$PATH:$M2_HOME/bin

刷新文件使其生效

$ source ~/.bash_profile

输入版本命令查看是否安装成功

$ mvn -v

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /Users/amadeus/apache-maven-3.5.0
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.4", arch: "x86_64", family: “mac"
posted @ 2017-04-10 18:46  海港余烟  阅读(291)  评论(0编辑  收藏  举报