You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michał Kowalcze <mi...@gmail.com> on 2016/01/02 16:28:33 UTC

[MNG-5947] dependency management: imports and lack of nearest-wins

Hello!

I've played a bit with maven dependency management section and basically
pom import in dependency management section does not support at all
"nearest-wins" strategy for resolving conflicts. The only one supported
option is first match.
I did not found anything in documentation about this behaviour - is it a
feature or a bug?

best regards,

Michał

Re: [MNG-5947] dependency management: imports and lack of nearest-wins

Posted by Michał Kowalcze <mi...@gmail.com>.
>
> Michal, does your change take imports nesting into account?
>

Yes, my patch determines distance between dependencies based on depth of a
particular dependency - and nesting is supported. However I'm still working
on an approach that will not change generated maven model classes as this
is more likely to go into version 3 of maven.
Basically the problem with current mode is that dependency management data
does not support at all tree-like structure. There's only flat list of
resolved dependencies - built during depth-first traversal of maven model -
so this is the reason of improper behavior.

Re: [MNG-5947] dependency management: imports and lack of nearest-wins

Posted by Anton Tanasenko <at...@gmail.com>.
Hi,
I did some research not so long ago to find out the way managed dependency
versions are resolved and ended up with a following logical lookup
algorithm:

Whichever is encountered first:
1. for each pom up the hierarchy:
   a. concrete dependency
   b. managed dependency
2. for each pom up the hierarchy
   a. for each import
      I. for each pom up the hierarchy
         i. managed dependency
      II. for each pom up the hierarchy
         i. for each import = 2.a.

e.g.:
1. current pom's concrete dependency
2. current pom's managed dependency
3. parent concrete dependency
4. parent managed dependency
... go up the parent hierarchy chain until no more parents found...

5. first imported pom's managed dependency
6. its parent's managed dependency
... up the parent hierarchy ...

7. first imported pom's first imported pom (yea you can nest those further)
8. it's parent...
...
9. first imported pom's second imported pom
...
10. second imported pom...
...


Michal, does your change take imports nesting into account?


2016-01-02 18:07 GMT+02:00 Michael Osipov <mi...@apache.org>:

> Am 2016-01-02 um 17:00 schrieb Michał Kowalcze:
>
>> Basically it's in https://issues.apache.org/jira/browse/MNG-5947 along
>> with
>> example POMs. Graphically - having imports in dependency management like:
>>
>> final:1.0
>>
>>      + import:1.0
>>
>>          +  parent:3.2.1
>>
>>              + commons-collections:3.2.1
>>
>>      + parent:3.2.2
>>
>>          +  commons-collections:3.2.2
>>
>>
>>
>> Version for commons-collections is 3.2.1 due to first match.
>>
>
> Nearest match makes sense to, i.e., shortest path to a node when several
> are in the dependency tree.
>
> Michael
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Regards,
Anton.

Re: [MNG-5947] dependency management: imports and lack of nearest-wins

Posted by Michael Osipov <mi...@apache.org>.
Am 2016-01-02 um 17:00 schrieb Michał Kowalcze:
> Basically it's in https://issues.apache.org/jira/browse/MNG-5947 along with
> example POMs. Graphically - having imports in dependency management like:
>
> final:1.0
>
>      + import:1.0
>
>          +  parent:3.2.1
>
>              + commons-collections:3.2.1
>
>      + parent:3.2.2
>
>          +  commons-collections:3.2.2
>
>
>
> Version for commons-collections is 3.2.1 due to first match.

Nearest match makes sense to, i.e., shortest path to a node when several 
are in the dependency tree.

Michael



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [MNG-5947] dependency management: imports and lack of nearest-wins

Posted by Michał Kowalcze <mi...@gmail.com>.
Basically it's in https://issues.apache.org/jira/browse/MNG-5947 along with
example POMs. Graphically - having imports in dependency management like:

final:1.0

    + import:1.0

        +  parent:3.2.1

            + commons-collections:3.2.1

    + parent:3.2.2

        +  commons-collections:3.2.2



Version for commons-collections is 3.2.1 due to first match.


Michał

Re: [MNG-5947] dependency management: imports and lack of nearest-wins

Posted by Ron Wheeler <rw...@artifact-software.com>.
Perhaps it might help to describe what you did, what you expected to 
happen and what actually happened.

Ron

On 02/01/2016 10:28 AM, Michał Kowalcze wrote:
> Hello!
>
> I've played a bit with maven dependency management section and basically
> pom import in dependency management section does not support at all
> "nearest-wins" strategy for resolving conflicts. The only one supported
> option is first match.
> I did not found anything in documentation about this behaviour - is it a
> feature or a bug?
>
> best regards,
>
> Michał
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org