linux 一分钟安装maven linux

mkdir maven

cd maven/

wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

tar -zxf apache-maven-3.6.3-bin.tar.gz

cd apache-maven-3.6.3

pwd | xargs -i echo 'export MAVEN_HOME='{}'' >> /etc/profile

echo 'export PATH=$PATH:$MAVEN_HOME/bin' >> /etc/profile

source /etc/profile

安装到此就结束了

如果要把maven的mirror源换成阿里云的源的话,可以打开settings.xml,这个文件一般在conf文件夹下

如图,红框内的是新增的内容

 

 文字如下,直接找到159行左右插入即可,当然每个版本的行号可能有出入,但是3.6.3版本的应该是159行左右位置插入。保存退出就可以了。

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

posted @ 2020-03-16 15:43  田野与天  阅读(148)  评论(0编辑  收藏  举报