代码改变世界

Ubuntu 22.04.1 LTS 安装与配置Maven

2023-04-25 14:39  猎手家园  阅读(1517)  评论(0编辑  收藏  举报

一、下载安装包

下载地址:Maven – Download Apache Maven

 

二、解压

tar zxf apache-maven-3.5.0-bin.tar.gz -C /usr/local

 

三、配置环境变量

vim /etc/profile

# Maven
export M2_HOME=/usr/local/apache-maven-3.5.0
export CLASSPATH=$CLASSPATH:$M2_HOME/lib
export PATH=$PATH:$M2_HOME/bin

保存并使之生效

:wq

source /etc/profile

 

四、检查

mvn -v

Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Maven home: /usr/local/apache-maven-3.5.4
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.15.0-70-generic", arch: "amd64", family: "unix"