下载

[root@localhost ~]# wget https://dlcdn.apache.org/maven/maven-3/3.9.8/binaries/apache-maven-3.9.8-bin.tar.gz
[root@localhost ~]# ls
apache-maven-3.9.8-bin.tar.gz

安装

创建安装目录:

[root@localhost ~]# mkdir /usr/local/maven/

解压到安装目录:

[root@localhost ~]# tar -zxvf apache-maven-3.9.8-bin.tar.gz -C /usr/local/maven/

设置环境变量

配置profile文件

vim /etc/profile

在末尾添加下面两行:

MAVEN_HOME=/usr/local/maven/apache-maven-3.9.8
export PATH=${MAVEN_HOME}/bin:${PATH}

使环境变量生效:

source  /etc/profile

检查安装:

[root@localhost ~]# mvn -v
Apache Maven 3.9.8 (ea98e05a04480131370aa0c110b8c54cf726c06f)
Maven home: /usr/local/maven/apache-maven-3.9.8
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"

修改源仓库

参考Windows 安装Maven-Kenvie's Blog,方法一样的

最后修改:2024 年 06 月 24 日
如果觉得我的文章对你有用,请随意赞赏