背景:
项目中用到了reflectAsm,我上 maven仓库 找到了gav,并添加到了pom.xml中。
但是公司的仓库貌似没有这个包,
[ERROR] Failed to execute goal on project xxxx: Could not resolve dependencies for project xxxxxx:jar:0.0.1-SNAPSHOT: Failure to find com.esotericsoftware:reflectasm:jar:1.11.7 in xxxx was cached in the local repository, resolution will not be reattempted until the update interval of my-nexus has elapsed or updates are forced -> [Help 1]
尝试解决:
于是我把settings.xml切换到ali仓库,成功编译,
本地仓库也有了对应的包。
但当我再次切回到公司的maven仓库之后,又提示相同错误。
The POM for com.esotericsoftware:reflectasm:jar:1.11.7 is missing, no dependency information available
最终解决方案
最后,我删除了本地仓库的相关文件夹,然后git clone了源码,通过mvn clean install命令把包打到本地,
之后再使用公司的仓库也不会报错了。
请问下:
- 我通过ali仓库把包拉下来的时候,本地仓库有对应的包,并且编译通过了,为什么切回到公司仓库之后还是会报错呢?
- The POM for com.esotericsoftware:reflectasm:jar:1.11.7 is missing, no dependency information available。这个错误信息到底指的是jar包找不到,其他的具体上面原因啊?
- 我在编译的时候,通过gav下载下来的包,和手动拉源码后install到本地的包,有什么区别啊?
- 我在什么地方的理解有偏差吗?
还请大佬赐教。。
其实问题已经被你自己回答了,你的两张截图已经说明了问题,Maven在搜索jar包失败之后会生成lastUpdated文件,这个文件会导致你的本地jar包无法被maven引入,至于底层原理有兴趣的同学可以扒一扒源码。。。。。