在Linux安装maven

2020-05-22  本文已影响0人  阿拉斌

安装包获取

官网:https://maven.apache.org/download.cgi

外网

内网

选择 Source tar.gz archive apache-maven-3.6.3-src.tar.gz 版本下载

解压安装

root@DESKTOP-AVEHH5N:/opt/package# wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
--2020-05-16 16:45:26--  https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9506321 (9.1M) [application/x-gzip]
Saving to: ‘apache-maven-3.6.3-bin.tar.gz’

apache-maven-3.6.3-bin.tar.gz             100%[===================================================================================>]   9.07M   839KB/s    in 11s     

2020-05-16 16:45:37 (839 KB/s) - ‘apache-maven-3.6.3-bin.tar.gz’ saved [9506321/9506321]

root@DESKTOP-AVEHH5N:/opt/package# tar -xvf apache-maven-3.6.3-bin.tar.gz apache-maven-3.6.3/
...

按照要求,它会被安装在

修改环境变量

root@DESKTOP-AVEHH5N:~# vim /etc/profile 

添加:export PATH=/opt/package/apache-maven-3.6.3/bin:$PATH

立即生效:source /etc/profile

root@DESKTOP-AVEHH5N:/opt/package# mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/package/apache-maven-3.6.3
Java version: 1.8.0_251, vendor: Oracle Corporation, runtime: /opt/package/jdk1.8.0_251/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-18362-microsoft", arch: "amd64", family: "unix"
root@DESKTOP-AVEHH5N:/opt/package# 
上一篇下一篇

猜你喜欢

热点阅读