首页 > 代码库 > Maven部署(linux)

Maven部署(linux)

1、下载
进入http://maven.apache.org/download.cgi下载。或者使用wget命令。
  1. mkdir /opt/maven
  2. cd /opt/maven
  3. wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.2.2/binaries/apache-maven-3.2.2-bin.tar.gz

2、解压
  1. cd /opt/maven
  2. tar -zxvf apache-maven-3.2.2-bin.tar.gz
  3. mv apache-maven-3.2.2 maven

3、配置环境变量
创建MAVEN_HOME,将MAVEN_HOME下的bin加入到PATH中。
vi /etc/profile,添加下述内容:
  1. export MAVEN_HOME=/opt/maven/maven
  2. export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/bin:$CATALINA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin

4、使配置生效
  1. source /etc/profile

5、验证
  1. mvn -version
输出:
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T21:51:42+08:00)
Maven home: /opt/maven/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /opt/jdk1.7.0_51/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.18-308.el5", arch: "amd64", family: "unix"



来自为知笔记(Wiz)