CentOS7系统如何安装配置maven

【原文链接】CentOS7系统如何安装配置maven

(1)下载maven包

wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

(2)解压包到 /usr/local/ 目录下

 tar -zxvf apache-maven-3.6.3-bin.tar.gz -C /usr/local/

(3)设置环境变量

vi  /etc/profile

在末尾增加如下内容

export M2_HOME=/usr/local/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin

然后执行

source /etc/profile

(4)执行mvn --versioin查看版本号

如下表示安装配置OK

[root@honghua-centos-02 apache-maven-3.6.3]# mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/apache-maven-3.6.3
Java version: 1.8.0_301, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_301/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.142-200.el7.x86_64", arch: "amd64", family: "unix"
[root@honghua-centos-02 apache-maven-3.6.3]#

你可能感兴趣的:(Java,maven,centos,java)