文章學(xué)習(xí)自作者@Dr.Zhu
原文地址如下:
開發(fā)過(guò)程中在pom.xml中添加pom的時(shí)候,默認(rèn)是需要從中央倉(cāng)庫(kù)中下載,但是下載的速度是非常慢的,超過(guò)一定的時(shí)間可能就覺(jué)得是eclipse卡死了。
比如我在剛引入一個(gè)maven組織的項(xiàng)目的時(shí)候,發(fā)現(xiàn)一直卡在9%不動(dòng),點(diǎn)開progress進(jìn)度條一看,速度感人。
解決辦法:
在maven中添加阿里的鏡像。
步驟:
- 找到maven安裝目錄下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>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>uk</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://uk.maven.org/maven2/</url>
</mirror>
<mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>nexus</id>
<name>internal nexus repository</name>
<!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
<url>http://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
- 重啟eclipse,速度果然上去了