1.看idea报错日志
mac在 /Users/xxxxxx/Library/Logs/JetBrains/IntelliJIdea2021.2 下
看到这句 Failure to transfer com.xxx.xxx:xxx:pom:1.0.0 from http://xxxxxx/nexus/content/groups/repositiry was cached in the local repository, resolution will not be reattempted until the update interval of b2bmirror-all has elapsed or updates are forced.
大致意思是无法将 xxx 下载到本地,因为已经缓存到本地了,可以通过等到更新间隔到时或强制更新来重试。 (SNAPSHOT版本的依赖有时会出现这个问题,但我的依赖并不是SNAPSHOT版本的,到底为什么会这样尚未找到原因,欢迎了解的同学指点一二,不胜感激)
2.执行maven强制更新
mvn clean install -U -Dmaven.test.skip=true
执行以上命令 搞定~
3.另外的思路-清除本地仓库
另外还有一个思路就是清除本地的依赖,maven提供了一个plugin实现这个功能,不过我没有尝试,有兴趣的同学可以试试看(其实直接删除本地的repository应该也是ok的)
The default behaviour of the plugin is to first resolve the entire dependency tree, then delete the contents from the local repository, and then re-resolve the dependencies from the remote repository.
大致意思是:首先解析整个依赖树,然后从本地仓库删除它们,然后重新从远程仓库解析
mvn dependency:purge-local-repository