开发者

Classpath issue using Ivy

开发者 https://www.devze.com 2023-02-10 09:41 出处:网络
I\'m using Ivy to manage my dependencies, and It\'s causing me issues with easymock my ivy.xml file has the following:

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.NoSuchMethod开发者_如何学JAVAError 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?


Generate an ivy dependency report to see exactly what versions ivy is using, for each configuration:

  <ivy:resolve/>
  <ivy:report todir='${ivy.reports}' graph='false' xml='false'/>

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消