maven无法从远程仓库更新jar包的问题处理-- Failure to transfer xxx.jar

使用eclipse的m2e插件创建maven工程时,eclipse开始更新本地仓库,我这网速太慢,就给强制停止了。然后pom就报了一堆的错误,如下:

 Description    Resource    Path    Location    Type
Failure to transfer com.thoughtworks.xstream:xstream:jar:1.4.3 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact com.thoughtworks.xstream:xstream:jar:1.4.3 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000    pom.xml    /testweb    line 1    Maven Configuration Problem

国内baidu到的解决方案都不靠谱,照例看老外的解决方式,原文如下:

i am trying to set up a project using Maven (m2eclipse), but I get this error in Eclipse:

Description    Resource    Path    Location    Type  Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.0.2 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.0.2 from/to central (http://repo1.maven.org/maven2): No response received after 60000   ExampleProject      Unknown Maven Problem

Any ideas? It would be helpful if you could show me how to check if everything is configured fine...

 

Remove all your failed downloads:

find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

For windows:

cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i

Then rightclick on your project in eclipse and choose Maven->"Update Project ...", make sure "Update Dependencies" is checked in the resulting dialog and click OK.

大致意思就是:

问:在使用m2eclipse创建maven工程时遇到这个问题,如何解决?

答:删除所有失败的更新(即仓库中所有以.lastUpdated结尾的文件)。

linux下cd到maven本地仓库目录,执行:

    find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

window下cd到maven本地仓库目录,执行:

    for /r %i in (*.lastUpdated) do del %i

然后到工程中选择 Maven->"Update Project ..."。

OK,按老外的方式,jar包重新开始下载,问题解决。

 

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值