简体   繁体   中英

Ivy Indirect Dependency Listed Twice

My classpath contains two different versions of an indirect dependency and I do not understand why.

My sub-project ("myJar") depends on a "utils" sub-project that depends on "lib-subprojA". I have the code to all these projects, but they are proprietary, so I cannot post snippets.

myProject-myJar -> myProject-utils -> lib-subprojA

I made a change in lib-subprojA; the last version before the change was 0.0.100-SNAPSHOT. The version that contains my change is 0.0.101-SNAPSHOT. When I look at the classpath of "myProject-myJar" I find both "lib-subprojA-0.0.100-SNAPSHOT.jar" (the old version) and "lib-subprojA-0.0.101-SNAPSHOT.jar" (the latest version). Not sure why both are in classpath, but I cannot get "myProject-myJar" to compile because it uses old version of "lib-subprojA".

This happens in Eclipse (with IvyDE) and sbt ( sbt clean update compile ). I have no idea why resolving the middle project ("myProject-utils") produces the correct dependency while resolving the leaf project ("myProject-myJar") brings in two versions of the same JAR ("lib-subprojA", versions 0.0.100, 0.0.101).

Is this because intermediate resolution results are cached? If so, how can I delete that cache?

lib-subprojA // Made change here. Old version: 0.0.100; new: 0.0.101
lib-subprojB
myProject-utils: dependency ... name="lib-subprojA"    rev="0.0.+" conf="compile->compile(*),master(*);runtime->runtime(*)"
  resolves to: lib-subprojA-0.0.101-SNAPSHOT.jar
myProject-myJar: dependency ... name="myProject-utils" rev="0.0.+" conf="compile->compile(*),master(*);runtime->runtime(*)"
  resolves to: lib-subprojA-0.0.100-SNAPSHOT.jar, lib-subprojA-0.0.101-SNAPSHOT.jar

It turns out that in one of the config files for lib-subprojA we had set local.ivy.dir to ${user.home}/ivy2 instead of ${user.home}/.ivy2 . I have spent a few hours tracking a single period character, no bigger than this: .

It all works as expected now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM