1、下载maven
wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.tar.gz
2、解压至/usr/local目录
tar -zxvf apache-maven-3.2.5-bin.tar.gz
3、配置国内的源
在mirrors中添加以下内容
- <mirror>
- <id>nexus-osc</id>
- <mirrorOf>*</mirrorOf>
- <name>Nexus osc</name>
- <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
- </mirror>
4、配置环境变量
etc/profile 最后添加以下两行
- export MAVEN_HOME=/usr/local/apache-maven-3.2.5
- export PATH=${PATH}:${MAVEN_HOME}/bin
5、测试
- [root@localhost ~]# mvn -v
- Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T09:29:23-08:00)
- Maven home: /usr/local/apache-maven-3.2.5
- Java version: 1.7.0_55, vendor: Oracle Corporation
- Java home: /usr/java/jdk1.7.0_55/jre
- Default locale: en_US, platform encoding: UTF-8
- OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix
6、关于本地仓库的位置
默认位置: ${user.home}/.m2/repository
windows:C:\Documents and Settings\Administrator\.m2
Linux:/root/.m2