But if version ranges are specified anywhere, then they take priority.

A version declaration without a range is effectively a "recommendation".
In your example, there are two "recommendations", so (as Brian said) the
one with the least "depth" is used, and in case of a tie then the first
found is used.

But if B declares a dependency on C version "[1.1]" then version 1.1 is
what will be used. Note that explicitly locked-down versions like this
are not generally a good idea in reusable libs, as it makes the lib
incompatible with anything declaring a dependency on [1.2,) for example;
when two conflicting ranges exist then maven will declare that there is
no available version and stop.

In no case will two copies of C be placed in the classpath. And the
behaviour is completely deterministic.

I'm sure this is documented in one or more of the Maven books available
online.

I'm not sure what your question about checksums was about. Maven never
needs to figure out what version a specific jarfile is. It first
determines what version it should pull in, then looks in the appropriate
place in a repository. Checksums exist only to detect data corruption
during upload or download of files.

Regards,
Simon

On Sun, 2008-05-25 at 10:28 -0400, Brian E. Fox wrote:
> Maven uses a nearest first, but in the example you provided C is the same
> depth. In this case it will go with the first version of C found, which is
> dependent on if A or B is listed first in your pom.
> 
> 
> On 5/25/08 7:05 AM, "Giovanni Azua" <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> > 
> > I have tried researching these questions but I did not find any
> > authoritative answer:
> > 
> > 1) If via transitive dependency resolution there is a conflict found i.e.
> > two dependencies use different versions of a fourth library, how does maven
> > resolves this? This is a.k.a. diamond problem:
> > 
> > "My Project"
> > |      |-----> A ---> C (version 1.0)
> > |
> > |------------> B ---> C (version 1.1)
> > 
> > If both C versions are pulled there will be runtime unpredictable behavior.
> > 
> > 2) If the point 1) is checked by Maven, how is it done? Using only version
> > numbers or md5sum? Is it possible enforcing the use of md5sum for this
> > purpose?
> > 
> > If you know where these questions are answered, pointing me to the location
> > will be most welcome!
> > 
> > TIA,
> > Best regards,
> > Giovanni
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 


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

Reply via email to