zhmg23

我们是如此的不同
资深运维工程师互荐群: 102123162

How to install Maven on CentOS

说明:在安装Maven 之前,我们首先要知道Maven 是干什么用的,不然我们安装干吗?某度上查了半天,全是废话,没有一个能让人一句话明白的,最后在某乎站上得到答案,Maven 是能够解决你jar包依赖的问题,对于新手,这是最易通俗好理解的!下面开始安装之旅


1、用wget命令下载apache-maven-3.0.5-bin.tar.gz

wget http://mirror.cc.columbia.edu/pub/software/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz


2、解压

sudo tar xzf apache-maven-3.0.5-bin.tar.gz -C /usr/local

cd /usr/local

mv apache-maven-3.0.5  /usr/local/apache-maven


3、设置环境变量

sudo  vim   ~/.bashrc 


export M2_HOME=/usr/local/apache-maven

export M2=$M2_HOME/bin 

export PATH=$M2:$PATH


source ~/.bashrc


4、查看验证

$  mvn -version

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)

Maven home: /usr/local/apache-maven

Java version: 1.8.0_92, vendor: Oracle Corporation

Java home: /usr/lib/jvm/java8/jre

Default locale: zh_CN, platform encoding: UTF-8

OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"



参考:http://preilly.me/2013/05/10/how-to-install-maven-on-centos/

http://stackoverflow.com/questions/7532928/how-do-i-install-maven-with-yum

评论