linux環境下安裝maven-3.6.3


1. 下載安裝包

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

 

2 解壓安裝包


tar -xzvf apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3 /opt/myprogram/

3 在maven配置文件中添加阿里雲鏡像

vi /opt/myprogram/apache-maven-3.6.3/conf/settings.xml

在標簽<mirrors>里添加內容:

<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>aliyun-maven</id>
       <mirrorOf>*</mirrorOf>
       <name>aliyun maven</name>
       <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

 

4 配置maven環境變量

vi  /etc/profile

添加以下內容

export M2_HOME=/opt/myprogram/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin

 使配置生效

source /etc/profile

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM