Mac 环境下Maven的安装与配置

Mac 环境下Maven的安装与配置

1.下载Maven

Maven官方下载地址
我这里选择下载:apache-maven-3.6.0-bin.tar.gz
解压到任意目录,我这里解压到

tar xvf /Users/xxxxxxxx/Documents/apache-maven-3.6.0-bin.tar

2.配置环境变量

配置环境变量

vim ~/.bash_profile

添加设置环境变量

#maven环境变量
export M2_HOME=/Users/xxxxxxxx/Documents/apache-maven-3.6.0
export PATH=$PATH:$M2_HOME/bin

执行命令立即生效

source ~/.bash_profile

检查配置是否生效

输入mvn -version或者mvn -v

mvn -version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
Maven home: /Users/xxxxxxxx/Documents/apache-maven-3.6.0
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.3", arch: "x86_64", family: "mac"

以上输出则配置成功

你可能感兴趣的:(maven构建)