3

My module A depends on modules B and C, which both depend on different versions of module D. My Ivy dependencies look like this:

<ivy-module>
<info organisation="com.a" module="A"/>
<configurations defaultconf="runtime">
    <conf name="runtime"/>
</configurations>
<dependencies>    
    <dependency org="org.b" name="B" rev="2.0" conf="runtime->default" />    
    <dependency org="org.c" name="C" rev="2.4" conf="runtime->default" />
    <conflict org="org.d" module="D" rev="2.4"/>
</dependencies>
</ivy-module>

I'm using a strict conflict resolution manager and it is correctly pointing out a conflict:

[ivy:retrieve] :: Apache Ivy 2.3.0-rc2 - 20121105223351 :: http://ant.apache.org/ivy/ ::
...
...
[ivy:retrieve] :::: ERRORS
[ivy:retrieve]  org.d#D;2.3 (needed by [org.c#C;2.4]) conflicts with org.d#D;2.4 (needed by [org.b#B;2.0])

Why doesn't the conflict tag tell Ivy to use version 2.4 of module D? I would like to use strict conflict resolution and then override conflicts one at a time so that it is clear where we are taking the risk of not using the version of a dependency that's mentioned in another project's pom/ivy. Adding an exclude of org.d to the org.c dependency removes the conflict, but it seems to me like using the conflict tag is more clear to future readers of the file.

rzrelyea
  • 1,467
  • 1
  • 13
  • 19
  • 1
    Not sure if this is really an answer, but I did eventually figure out that if I switched the order of the dependencies the conflict tag evicted the correct dependency. I re-read the [conflict documentation](http://ant.apache.org/ivy/history/latest-milestone/ivyfile/conflict.html) and it does say that order matters. However, it doesn't say how to figure out which is the correct order, so it's up to the user to just try different dependency orders until you find one that works. – rzrelyea Apr 05 '13 at 21:33

1 Answers1

1

You could also try to set the force attribute for module D. This will force Ivy to take 2.4 in this example:

<dependency org="org.d" module="D" rev="2.4" conf="runtime->default" force="true" />