您的位置:首页 > Web前端

使用maven时出现failure to transfer错误,下载jar慢

2017-03-30 14:54 561 查看
在eclipse里使用maven,连接nexus私服。

添加依赖之后,总是报添加的依赖jar文件找不到,但是在nexus的库里面能找到这个依赖的jar文件,但是在本地的maven库里面找不到,于是我将本地库里面这个依赖对应的文件夹删掉,然后在eclipse里面执行update
dependencies。成功解决问题!

右键单击项目->maven->update dependencies。

引起的原因是由于本地库从nexus中请求jar文件,如果私服中不存在则取网上下载,如果网速过慢,下载时间超过了maven设置的时间限制就会报该错误。
加入阿里云资源,速度会快很多

在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>
-->

<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
</mirrors>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐