解決網速慢時maven倉庫訪問慢


構建maven項目時會下載很多依賴,會從官網地址下載是個外國網站,訪問速度會很慢,但可以通過修改maven的settings.xml文件換成國內的鏡像地址就可以加快訪問速度:

一、找到settings.xml

(1)我的放在C:\Users\zrk\.m2下

(2)idea里依次點File->Settings,在彈出框搜索maven,可以查看或配置路徑

(3)eclipse下可以參考:

https://www.cnblogs.com/flying607/p/6223148.html

二、修改配置

打開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.
        |

        -->
    </mirrors>

在mirrors中添加一個<mirror>,保存即可

<mirror>
      <id>mirrorId</id>
      <mirrorOf>central</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>

最終效果:

 


免責聲明!

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



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