您的位置:首页 > 其它

在国内使用maven下载jar包非常慢的解决方法

2017-02-14 00:33 489 查看

在国内使用maven下载jar包非常慢的解决方法

1、原因:

很多jar包在国外环境,所以会很慢。

2、解决方法

maven支持镜像环境下载,所以首先找到maven的conf目录中的settings.xml文件,其中有

<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>
-->
</mirrors>

将这里的镜像环境改为国内的镜像环境(推荐使用阿里的镜像环境):

<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
</mirrors>

之后再下载jar包就会快很多了。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: