CentOs 安装maven3.0.5

安装maven
1. 首先要确保已安装了jdk
2. 上传apache-maven-3.0.5-bin.tar.gz到服务器
3. 解压apache-maven-3.0.5-bin.tar.gz 使用命令:
tar -zxvf apache-maven-3.0.5-bin.tar.gz
4. 修改环境变量 vi /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.7.0_79
    export JRE_HOME=/usr/local/java/jdk1.7.0_79/jre
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
    export MAVEN_HOME=/root/apache-maven-3.0.5
    export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$MAVEN_HOME/bin:$PATH

5. 让环境变量配置生效执行以下命令:
source /etc/profile
6. 验证是否配置成功
mvn –v
[root@localhost ~]# mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)
Maven home: /root/apache-maven-3.0.5
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_80/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-504.el6.x86_64", arch: "amd64", family: "unix"

出现以上字样表示安装成功!

你可能感兴趣的:(linux)