Maven部署(linux)
1、下载
进入http://maven.apache.org/download.cgi下载。或者使用wget命令。
mkdir /opt/maven
cd /opt/maven
wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.2.2/binaries/apache-maven-3.2.2-bin.tar.gz
2、解压
cd /opt/maven
tar -zxvf apache-maven-3.2.2-bin.tar.gz
mv apache-maven-3.2.2 maven
3、配置环境变量
创建MAVEN_HOME,将MAVEN_HOME下的bin加入到PATH中。
vi /etc/profile,添加下述内容:
export MAVEN_HOME=/opt/maven/maven
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/bin:$CATALINA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin
4、使配置生效
source /etc/profile
5、验证
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"