eclipse加载maven工程提示pom.xml无法解析org.apache.maven.plugins:maven-resources-plugin:2.4.3解决方案

最近碰到这个问题,一直在整理maven的jar包问题,最后是发现很多jar包现在的过程中可能没有下完就被关闭,或者下载失败,就会出现很多的*.lastUpdated文件,这些文件使得系统认为某些jar包没有倍下载成功,因此出现了不可是别的现象。

错误:

1. The type org.springframework.context.ConfigurableApplicationContext cannot be resolved.

2. Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 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-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2): Access denied to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.pom. Error code 407, Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied.  )log4j-test01UnknownMaven Problem

这两个错误都会有可能是lastupdated的问题引起。

解决方法1:

1.找到maven库目录,进入:~\.m2\repository\org\apache\maven\plugins\maven-surefire-plugin\2.7.1

2.若2.7.1目录下只有,"maven-surefire-plugin-2.7.1.pom.lastUpdated" 则需要到http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/,把里面的文件下载下来放到2.7.1

3.删除2.7.1下的maven-surefire-plugin-2.7.1.pom.lastUpdated文件。(重要)

4.项目右键-->maven-->Update Dependencies


删除所有的lastupdated文件方法:

项目使用maven管理jar包,很容易因为各种原因(网速慢、断网)导致jar包下载不下来,出现很多.lastUpdated文件。这些文件一个一个删除太麻烦。下面是全部删除的方法


windows系统

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

linux系统

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

 

find /app/mujup/maven/localRepository -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;


最后clean后如果还有叹号或者错误,就maven-update project后即可解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值