Jason,

I just had one of those light bulb moments that only happens after hitting
the send button. :-)

Here is what I read at
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html:

>> *"Dependency mediation* - this determines what version of a dependency
will be used when multiple versions of an artifact are encountered.
Currently, Maven 2.0 only supports using the "nearest definition" which
means that it will use the version of the closest dependency to your project
in the tree of dependencies."

Dependency hibernate-core takes less hops to find slf4j-api than Child A
does.

Paul

On Mon, Sep 28, 2009 at 11:07 PM, Jason van Zyl <[email protected]> wrote:

> Make a test project to express the problem. In almost all cases it's
> impossible to debug or discuss this without a test project everyone can run.
>
> Unfortunately you can't rely 100% on the output of particular plugins wrt
> dependency resolution because they can all change the output with different
> input parameters and artifact filters.
>
>
> On 2009-09-28, at 8:54 PM, Paul Benedict wrote:
>
>  I have a project structure like this:
>>
>> Parent A
>>  * Declares managed dependency org.slf4j:slf4j-api:1.5.8
>>  * Declares managed dependency org.hibernate:hibernate-core:3.3.1.GA
>>  * Declares managed dependency org.hibernate:hibernate-annotations:
>> 3.4.0.GA
>> Child A
>>  * Depends on org.hibernate:hibernate-core
>>  * Depends on org.hibernate:hibernate-annotations
>>
>> When I run dependency:list for Child A, I see that version
>> org.slf4j:slf4j-api:1.5.8 is selected. This is expected and correct
>> because:
>> 1) hibernate-core relies on 1.5.2 (loses)
>> 2) hibernate-annotations depends on 1.4.2 (loses)
>> 3) My managed version wins
>>
>> Now here is my second project:
>>
>> Parent B
>>  * Declares managed dependency Child A
>>  * Declares managed dependency org.hibernate:hibernate-core:3.3.1.GA
>>  * Declares managed dependency org.hibernate:hibernate-annotations:
>> 3.4.0.GA
>> Child B
>>  * Depends on Child A
>>  * Depends on org.hibernate:hibernate-core
>>  * Depends on org.hibernate:hibernate-annotations
>>
>> When I run dependency:list for Child B, I see that version
>> org.slf4j:slf4j-api:1.5.2 is selected.
>>
>> Why wouldn't the managed dependency from Child A win?
>>
>> Paul
>>
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ----------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to