On Thu, 2008-03-13 at 17:11 +0100, David Delbecq wrote:
> Hello,
> 
> i have a question relative to behaviour of maven when there are 
> conflicting inherited dependency version. I expected maven to pick-up 
> most recent version when presented to having to make a choice. However, 
> it seems it just take the first inherited version it encounter on the 
> tree and discard all other inherited version. Is it expected behaviour? 
> Or is it going to change? Is it configurable?
> 
> The only way is seem to find out to solve this, is to use the 
> <exclusion> mechanism on the library that uses the oldest version.

Maven chooses the version declaration that is "least transitive". Or in
other words, the one that is declared "closest to the pom being
executed".

So anything in *your* pom overrides anything else.

If your pom doesn't specify, then what is specified in the pom for
direct dependency A is preferred over what is in poms that are two
levels of indirection away.

I'm not sure what happens if your pom declares dependencies on A and B
and their poms declare different versions of C (ie in both cases, the
version declaration for C is 1 step away from the main pom). I suspect
the first one found is chosen, but that's just a guess.

But in any case, what happens is deterministic, ie maven behaves the
same each time it is run with the same inputs. And declarations in your
pom have precedence. So if you don't like what version is selected, just
add a direct dependence in your pom to the problem lib, with whatever
version you prefer. Using an exclusion would also work, but seems less
clear to me.

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to