问题描述
我正在开发一个使用 ant + ivy 进行构建过程的项目。
由于 Intellij IDEA 是我的主要开发 IDE,因此我下载了 IvyIDEA 插件,以便自动执行 ivy 解决依赖项的过程。
一段时间后,我注意到并非所有依赖项都已下载,其中一些已下载,但缺少一些自定义工件。我通过插件检查了生成的依赖项列表,其中一些实际上丢失了,认为解析过程已成功完成:
report for projName compile produced in C:\Users\test\.ivy2\cache\projName-compile.xml
resolve done (6375ms resolve - 156ms download)
post 1.3 ivy file: using exact as default matcher
post 1.3 ivy file: using exact as default matcher
post 1.3 ivy file: using exact as default matcher
post 1.3 ivy file: using exact as default matcher
post 1.3 ivy file: using exact as default matcher
post 1.3 ivy file: using exact as default matcher
post 1.3 ivy file: using exact as default matcher
No problems detected during resolve for module 'ProjName' [All configurations].
我开始深入研究插件生成的 ivy 日志,并看到了一堆不同的依赖项:
Sort dependencies of : projToImport;1.1.85300.20210326.5 / Number of dependencies = 8
Non matching revision detected when sorting. projToImportdepends on anotherProj;1.1.81201.20210326.1,doesn't match anotherProj;1.1.81201.20210406.1
Module descriptor is processed : junit#junit;4.11
....
重要说明:当我在安装了 Ivy 插件的 Eclipse IDE 中执行相同操作时,一切正常,我可以看到 ivy.xml 中描述的所有依赖项这让我认为我的 ivy-settings .xml 和 ivy.xml 文件是正确的。
所以,我假设 IvyIDEA 插件无法以正确的方式工作。如何解决这个问题?
解决方法
问题出在 ivy 版本上:我使用的当前版本的 IvyIDEA 插件 (1.0.16) 包含 ivy 2.5.0,我必须使用 ivy 2.4.0 才能运行我的 ivy-settings.xml\ ivy.xml。
所以我的解决方案是将 ivy 降级到 2.4.0 版。