Maven國內阿里鏡像(Maven下載慢的解決方法)


  Maven是當前流行的項目管理工具,但官方的庫在國外經常連不上,連上也下載速度很慢。國內oschina的maven服務器很早之前就關了。今天發現阿里雲的一個中央倉庫,親測可用。

1 <mirror>
2     <id>alimaven</id>
3     <mirrorOf>central</mirrorOf>
4     <name>aliyun maven</name>
5     <url>https://maven.aliyun.com/repository/central</url>
6 </mirror>

  修改${maven.home}/conf或者${user.home}/.m2文件夾下的settings.xml文件,在<mirrors>標簽下加入上述內容即可。如下:

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
 3           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4           xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 5     <mirrors>
 6         <!-- 阿里雲倉庫 -->
 7         <mirror>
 8             <id>alimaven</id>
 9             <mirrorOf>central</mirrorOf>
10             <name>aliyun maven</name>
11             <url>https://maven.aliyun.com/repository/central</url>
12         </mirror>
13     
14         <!-- 中央倉庫1 -->
15         <mirror>
16             <id>repo1</id>
17             <mirrorOf>central</mirrorOf>
18             <name>Human Readable Name for this Mirror.</name>
19             <url>http://repo1.maven.org/maven2/</url>
20         </mirror>
21     
22         <!-- 中央倉庫2 -->
23         <mirror>
24             <id>repo2</id>
25             <mirrorOf>central</mirrorOf>
26             <name>Human Readable Name for this Mirror.</name>
27             <url>http://repo2.maven.org/maven2/</url>
28         </mirror>
29     </mirrors> 
30 </settings>

   更多阿里雲的Maven鏡像倉庫地址,如releases、snapshots,可參見https://maven.aliyun.com/mvn/view


免責聲明!

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



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