在执行maven clean package时遇到如下错误提示:

 Could not resolve dependencies for project org.springframework.boot:XXXX:jar:2.0-SNAPSHOT: Failed to collect dependencies at com.XXXX:XXXX:jar:2.0-SNAPSHOT: Failed to read artifact descriptor for com.XXXX:XXXX:jar:2.0-SNAPSHOT: Failure to find com.XXXX:XXXX:pom:2.0-SNAPSHOT in http://XXXX:XXXX/repository/maven-snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of maven-snapshots has elapsed or updates are forced -> [Help 1]

【问题原因】:由缓存导致

Maven默认会使用本地缓存的库来编译工程,对于上次下载失败的库,maven会在~/.m2/repository/<group>/<artifact>/<version>/目录下创建xxx.lastUpdated文件,一旦这个文件存在,那么在直到下一次nexus更新之前都不会更新这个依赖库。

解决办法】:删除缓存或者强制每次都更新依赖库

1. 删除缓存

删除v~/.m2/reposit

在执行maven clean package时遇到如下错误提示: Could not resolve dependencies for project org.springframework.boot:XXXX:jar:2.0-SNAPSHOT: Failed to collect dependencies at com.XXXX:XXXX:jar:2.0-SNAPSHOT: Failed ...