Centos7 安装 maven3.9.6

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

1.下载 maven 3.9.6 安装包

wget https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz --no-check-certificate

2.创建一个安装 maven 的目录

mkdir /usr/local/maven

3.解压下载的软件包

tar -zxvf apache-maven-3.9.6-bin.tar.gz -C /usr/local/maven/

4.配置环境变量

cat << EOF >> /etc/profile 

MAVEN_HOME=/usr/local/maven/apache-maven-3.9.6
PATH=\$PATH:\$MAVEN_HOME/bin
export MAVEN_HOME

EOF source
/etc/profile

5.查看新安装的 maven 版本。

mvn --version

 6.配置阿里云远程仓库

复制代码
vim /usr/local/maven/apache-maven-3.9.6/conf/settings.xml

<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <mirror> <id>aliyunmaven</id> <mirrorOf>*</mirrorOf> <name>阿里云公共仓库</name> <url>https://maven.aliyun.com/repository/public</url> </mirror> </mirrors>
复制代码

 

posted @   苦逼yw  阅读(418)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
点击右上角即可分享
微信分享提示