- 系统:macOS Sierra
- Maven版本:apache-maven-3.5.0
apache下载Maven:
- 进入apache官网下载:https://maven.apache.org/download.cgi
- 解压到某目录。如:/Volumes/SD/开发/开发工具/apache-maven-3.5.0
使用终端设置 Maven classpath:
- 在“终端”输入如下命令来配置变量
vi ~/.bash_profile
- 进入vi编辑器后,添加以下两条代码,并保存退出vi编辑器:
export M2_HOME=/Volumes/SD/开发/开发工具/apache-maven-3.5.0
export PATH=$PATH:$M2_HOME/bin
如下图:
- 输入命令以使bash_profile生效
aiuiotcom:~ aiuiot$ source ~/.bash_profile
- 输入mvn -v查看Maven是否安装成功
aiuiotcom:~ aiuiot$ mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /Volumes/SD/开发/开发工具/apache-maven-3.5.0
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre
Default locale: zh_TW, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.5", arch: "x86_64", family: "mac"
aiuiotcom:~ aiuiot$