0
点赞
收藏
分享

微信扫一扫

云服务器——安装Maven

罗蓁蓁 2023-09-07 阅读 48

1.首先新建一个maven文件夹用于下载maven安装包,可采用直接官网下载压缩包上传至服务器,也可以采用wget直接下载,这里采用wget下载

wget https://archive.apache.org/dist/maven/maven-3/3.8.2/binaries/apache-maven-3.8.2-bin.tar.gz

2.下载完之后解压缩

tar -zxvf apache-maven-3.8.2-bin.tar.gz

3.(可选)配置阿里云镜像下载,在conf/setting.xml中添加镜像下载加速地址

<mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>

4.设置本地仓库地址,同样是编辑conf/setting.xml

# 设置本地仓库地址
<localRepository>/root/maven/repository</localRepository>

5.设置环境变量,编辑/etc/profile

# MAVEN_HOME
export MAVEN_HOME=/root/maven/apache-maven-3.8.2
export PATH=$PATH:$MAVEN_HOME/bin

6.刷新/etc/profile配置文件

source /etc/profile

7.查看maven版本

mvn -v
举报

相关推荐

0 条评论