Loading

centos7 安装maven

烂笔头

1:从官网下载包 apache-maven-3.8.3-bin.tar.gz
2:传输到服务器,你可以用u盘,远程工具或者,直接用上个链接下载到服务器或centos主机
3:解压 : tar -zxvf apache-maven-3.8.3-bin.tar.gz 注意自己下载的版本
4:添加path vim /etc/profile ,你的centos上可能没有vim 同样你可以使用vi命令 vi /etc/profile
5:在此文件的最下一行添加 export PATH=$PATH:/usr/local/maven3.8/bin /usr/local/maven3.8 是我解压后移动到的位置,你如果放在别的地方了,更改下路径
6:保存退出vim 或vi
7:source /etc/profile 刷新path文件
8:mvn --version 测试是否成功

成功

设置加速
vim /usr/local/maven3.8/conf/settings.xml
添加源
标签中添加

 <mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
  </mirror>
posted @ 2021-10-30 17:34  JJiaa  阅读(82)  评论(0编辑  收藏  举报