mvn clean install -U
-U,–update-snapshots
Forces a check for missing releases and updated snapshots on remote repositories
打开IDEA Settings(Mac上是IDEA Preferences),找到Maven,勾选“Always update snapshots"。
再用Maven / Reimport来更新依赖。
修改settings.xml,在repository和pluginRepository下配置总是更新Maven snapshots依赖:
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
enabled
: Whether to use this repository for downloading this type of artifact. Default value is: true
.
updatePolicy
: The frequency for downloading updates - can be “always”, “daily” (default), “interval:XXX” (in minutes) or “never” (only if it doesn’t exist locally). Each repository in the project has its own update policy:
将本地Maven缓存(~/.m2/repository)的snapshot依赖删除掉,再重新更新依赖。
如果在parent项目中用dependencyManagement来统一管理依赖的版本号,需要检查本地Maven repository(~/.m2/repository)下的parent项目的.pom
文件是否是最新的。