CentOS安装Maven

2022-01-20 16:15:22 浏览数 (1)

下载

代码语言:javascript复制
[root@localhost ~]# wget https://ali.kenvie.com/Downloads/apache-maven-3.8.2-bin.tar.gz
[root@localhost ~]# ls
apache-maven-3.8.2-bin.tar.gz

安装

创建安装目录:

代码语言:javascript复制
[root@localhost ~]# mkdir /usr/local/maven/

解压到安装目录:

代码语言:javascript复制
[root@localhost ~]# tar -zxvf apache-maven-3.8.2-bin.tar.gz -C /usr/local/maven/

设置环境变量

配置profile文件

代码语言:javascript复制
vim /etc/profile

在末尾添加下面两行:

代码语言:javascript复制
MAVEN_HOME=/usr/local/maven/apache-maven-3.8.2
export PATH=${MAVEN_HOME}/bin:${PATH}

使环境变量生效:

代码语言:javascript复制
source  /etc/profile

检查安装:

代码语言:javascript复制
[root@localhost ~]# mvn -v
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
Maven home: /usr/local/maven/apache-maven-3.8.2
Java version: 1.8.0_301, vendor: Oracle Corporation, runtime: /usr/local/java/jdk1.8.0_301/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1062.el7.x86_64", arch: "amd64", family: "unix"

修改源仓库

参考修改Maven源仓库

版权属于:kenvie

本文链接:https://cloud.tencent.com/developer/article/1937720

商业转载请联系作者获得授权,非商业转载请注明出处。

0 人点赞