Maven依赖中类似was cached in the local repository样的错误

我们在使用maven编译一个项目时经常会遇到诸如此类的问题。
   
   
Could not get the value for parameter encoding for plugin execution default-resources
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failure to find org.codehaus.plexus:plexus-utils:jar:1.1 in http://nexusserver:8081/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of mirr...
   
   
was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced ->
大体意思是jar包没有下载完整,不过也要分两种情况。

一种可能就是本地没有下载完整,这里的原因可能第一次下载由于网络原因不成功,之后maven也没在尝试。

引用
This is often a false positive. Imagine you have a connection issue lasting only 5 seconds when Maven 3 tries to download a dependency, it will mark this dependency as unavailable for a delay. And thus will prevent you from replaying the build command even if the network issue is fixed. 
Just run the command with the -U option. Even if its description applies to snapshots, it seems to also fix the error if it occurred on a release. 
Example: mvn -U clean package

此外,我们可以在setting.xml中增加updatePolicy策略

setting.xml指导

在setting.xml的schema中有这样一个描述


schema

另一种情况就是我们依赖的nexus也没有下载完整,这时候可能是配置的中央仓库代理仓库根本就不存在此jar,或者需要在第三方仓库中才能找到,此时我们应该尝试检查和配置代理仓库。

  • 6
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值