天天看點

CentOS7 安裝Maven 3.6

  • 下載下傳安裝
# http://maven.apache.org/download.cgi
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz
tar xvf apache-maven-3.6.2-bin.tar.gz -C /usr/local/
#配置環境變量
vim /etc/profile
export MAVEN_HOME=/usr/local/apache-maven-3.6.2
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile
#測試
mvn -version
           
  • 設定阿裡雲Maven倉庫位址
#mirrors 及诶點下添加mirror子節點
vim /usr/local/apache-maven-3.6.2/conf/settings.xml
   <mirror> 
     <id>alimaven</id> 
     <name>aliyun maven</name> 
 <url>http://maven.aliyun.com/nexus/content/groups/public/</url> 
     <mirrorOf>central</mirrorOf> 
   </mirror>  

#https://yq.aliyun.com/articles/659803
#或者project節點新增如下
<repositories>
        <!-- 遠端倉庫位址 -->
        <repository>
            <id>nexus-aliyun</id>  
         <name>Nexus aliyun</name>  
 <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </repository>

</repositories>