1:首先从官网下载压缩包:
2:解压缩配置文件:
topwqp:Documents wangqiupeng$ tar -zxvf apache-maven-3.2.3-bin.tar.gz
解压后的目录结构如下:
topwqp:apache-maven-3.2.3 wangqiupeng$ ls
LICENSE README.txt
boot lib
NOTICE bin
conf
3:添加到环境变量PATH中
topwqp:~ wangqiupeng$ vi .bash_profile
填充内容如下:
MAVEN_HOME=/Users/wangqiupeng/Documents/apache-maven-3.2.3
PATH=$PATH:$MAVEN_HOME/bin
export MAVEN_HOME
export PATH
~
4:使配置文件生效:
topwqp:~ wangqiupeng$ source .bash_profile
5:查看maven是否安装成功:
topwqp:~ wangqiupeng$ mvn -v
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T04:58:10+08:00)
Maven home: /Users/wangqiupeng/Documents/apache-maven-3.2.3
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: zh_CN, platform encoding: EUC_CN
OS name: "mac os x", version: "10.10", arch: "x86_64", family: "mac"
6:ok以上证明maven安装成功
refer: http://blog.csdn.net/anialy/article/details/22217937