sunny123456

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

resolution will not be reattempted until the update interval of XXX has elapsed or updates are force

环境

Java:1.8
maven:3.6.1

前言

我只是在pom.xml文件中,将version的数字改了下,结果出问题了。
包总是下不下来。所以idea的引用也没有更新。

其实这是一个很简单的错误,奈何我以前的工作都是手动导包。导致我maven的能力偏弱。

错误消息

[ERROR] Failed to execute goal on project model: 
Could not resolve dependencies for project com.xingren.clinic:model:jar:1.0.0-SNAPSHOT: Failure to find com.xingren.service:medevac-client:jar:1.2.33-SNAPSHOT in http://nexus.aihaisi.com/repository/public/ was cached in the local repository, 
resolution will not be reattempted until the update interval of xr-public has elapsed or updates are forced -> [Help 1]
  • 1
  • 2
  • 3

主要错误消息,如题:
就是resolution will not be reattempted until the update interval of XXX has elapsed or updates are force

意思就是:

在 XXX的更新间隔过去或强制更新之前,不会重新尝试解析。

如果你去本地的maven仓库,你会发现,其只有lastUpdate结尾的文件,没有jar包。

这个时候,你无论怎么点击IDEA中的Reimports All Maven Projects都是没有用的。原因上面也说了,要么等更新时间过去,要么强制更新。
maven的默认更新时间为day,即一天更新一次。

所以我们一般都是采用强制更新的方式。

解决办法

命令行的方式

mvn clean install -U
  • 1

修改settings.xml

添加<updatePolicy>always</updatePolicy>

<repositories>
   <repository>
     <id>xr-snapshots</id>
 	  <url>http://nexus.alibaba.com/repository/snapshots/</url>
     <snapshots>
       <enabled>true</enabled>
       <!-- 注意 -- >
       <updatePolicy>always</updatePolicy>
     </snapshots>
     <releases>
       <enabled>false</enabled>
       <!-- 注意 -- >
       <updatePolicy>always</updatePolicy>
     </releases>
   </repository>
 </repositories>

<pluginRepositories>
<pluginRepository>
<id>xr-plugins</id>
<name>xingren plugins</name>
<url>http://nexus.alibaba.com/repository/public/</url>
<releases>
<enabled>true</enabled>
<!-- 注意 -- >
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<!-- 注意 -- >
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

我采用的是使用命令行。

总结

在确定远程仓库jar包存在,配置也没有错的情况下,
使用强制更新。

参考地址:
https://www.cnblogs.com/huojiao2006/articles/5195965.html
https://stackoverflow.com/questions/4701532/force-maven-update

https://blog.csdn.net/u013066244/article/details/91986308
posted on 2022-10-19 18:21  sunny123456  阅读(166)  评论(0编辑  收藏  举报