Maven依赖包下载慢--阿里云让你飞

时间:2024-10-12 09:04:14

  当用maven下载依赖包的时候,用官方的镜像库,那慢的真是要死要死的。后来在网上搜到英国的库(也是慢的不行),国内的oschina更是直接没法下载呀。不过还好突然发现阿里云也有镜像库,尝试了以下,速度真是爽到爆,和官方镜像库比,真是一个天上,一个地下。好了,不吐槽了,直接看配置。

  就是更改用户下的settings.xml文件,在<mirrors> </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>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
<mirror>
<!--This is used to direct the public snapshots repo in the
profile below over to a different nexus group -->
<id>nexus-public-snapshots</id>
<mirrorOf>public-snapshots</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/repositories/snapshots/</url>
</mirror>
</mirrors>

  看看下边这速度,杠杠的:

  Maven依赖包下载慢--阿里云让你飞

  享受飞一般的感觉吧