构建时报错信息如下:
在这里插入代码片
> [ERROR] Failed to execute goal on project vfactory: Could not resolve dependencies
> for project com.nan:vfactory:jar:1.0.0: Failure to find javax.annotation:javax.annotation-
> api:jar:1.3.2 in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the
> local repository, resolution will not be reattempted until the update interval of alimaven
> has elapsed or updates are forced -> [Help 1]
并且无论怎么更改代码都不能解决,着实给人气死,特记此以诫之
问题原因 :
Maven默认会使用本地缓存的库来编译工程,对于上次下载失败的库,maven会在~/.m2/repository目录下创建xxx.lastUpdated文件,一旦这个文件存在,那么在直到下一次nexus更新之前都不会更新这个依赖库。
我的解决方案,在 ~/.m2/repository目录下找到maven缓存的包,并且删掉,重新构建即可
无论是Windows还是Linux,只需要删掉maven缓存仓库下对应的包并删掉即可,一般都是在.m2目录中,具体位置可以自行搜索
其他方案:https://blog.51cto.com/qiangsh/1743074