使用 Ivy 的类路径问题
我正在使用 Ivy 来管理我的依赖项,这导致我的 easymock 出现问题,
我的 ivy.xml 文件具有以下内容:
<dependency org="easymock" name="easymock" rev="2.5.+" conf="compile,test -> default" />
然后我遵循其他库依赖项,希望万一其他库使用 Easymock 的另一个版本,那么至少我的图书馆得到了正确的。
但是在我解决之后,在 eclipse 中我可以看到有 2 个版本的 easymock(1.2 和 2.5),然后首先列出 1.2。
当我运行单元测试时,我在 org.easymock.internal.RecordState 的构造函数上收到 java.lang.NoSuchMethodError ,该构造函数采用 org.easymock.internal.IMocksBehavior 。
这表明我正在使用旧版本的 EasyMock。
我有什么想法可以解决这个问题吗?
I'm using Ivy to manage my dependencies, and It's causing me issues with easymock
my ivy.xml file has the following:
<dependency org="easymock" name="easymock" rev="2.5.+" conf="compile,test -> default" />
and then I follow with other library dependencies, hoping that in case some other library uses another version of easymock then at least my library gets the correct one.
but then after I resolve, in eclipse i can see that there are 2 versions of easymock (1.2 and 2.5) and then the 1.2 is listed first.
and when I run my unit test, I'm getting a java.lang.NoSuchMethodError on the contstructor of org.easymock.internal.RecordState which takes org.easymock.internal.IMocksBehavior.
which suggest I'm hitting the old version of EasyMock.
Any ideas how can I get around this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
生成 ivy 依赖关系报告,以准确查看 ivy 正在使用的每个配置的版本:
通常,当 ivy 遇到同一库的两个版本时,它会“逐出”旧版本。
要解决冲突解决不正确的问题,我建议阅读 doco< /a>
更新
Ivy 的冲突算法过去一直对我很有效,但我必须承认我从未完全理解传递分析的一些复杂性。以下 Maven 文章值得一读:
http://guntherpopp.blogspot.com /2011/02/understanding-maven-dependency.html
Generate an ivy dependency report to see exactly what versions ivy is using, for each configuration:
Normally when ivy encounters two versions of the same library it will "evict" the older version.
To fix problems with incorrect conflict resolution I'd suggest reading the doco
Update
Ivy's conflict algorithms have always worked well for me in the past, but I must admit I never fully understood some of the complexities of transitive analysis. The following Maven article is worth reading:
http://guntherpopp.blogspot.com/2011/02/understanding-maven-dependency.html
我在 ibiblio 镜像中看到的最新的 easymock 版本是 2.0。这意味着找不到 2.5 并且使用了旧版本。检查您的解析器设置和修订。
它还有助于偶尔清理一次缓存(ivy:cleancache),因此 ivy 被迫在存储库中搜索修订版本。
The latest easymock I can see in the ibiblio mirrors is rev 2.0. That would mean, that 2.5 is not found and an older Version is used. Check your resolver settings and revisions.
It also helps to clean the cache once in a while (ivy:cleancache) so ivy is forced to search the repos for revisions.