maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephane Nicoll (JIRA)" <>
Subject [jira] [Commented] (MNG-5971) Dependency management in a child project cannot override a version using a BOM
Date Wed, 17 Feb 2016 16:29:18 GMT


Stephane Nicoll commented on MNG-5971:

Okay let me try to clarify. I don't think I am asking for anything funky. I want that anything
that is defined closers "wins" _regardless of how it is added_. 

Think it this way (with a A -> B -> C hierarchy where C is the  child and A the grand-parent).
A resolves its dependency management (including the ones from BOM). That gives a unified dependency
management. Then B applies and does the same thing, adding or overriding some entries if necessary.
Then C does. To me it's much more consistent to do things that way because you need that whatever
you define at a given level will override the values from the parent if necessary.

Imports never overwrite anything already present in the model.

This very issue is about the fact that adding the dependency directly works, adding a bom
that defines said dependency doesn't. IMO this is inconsistent considering how we're using
BOM (= share a dependency management section).

Answering to your question. Of course I don't want that. I just want that whatever is defined
in the user project overrides what the parent provides. So let's say that the parent provides
{{}}. If the user adds {{}} then all is well. If the user
adds a bom that contains a dependency management for {{}} it doesn't. That's
the problem I am trying to raise here.

In my mind there is no conflict: I am using the tools Maven provides to have a decent dependency
management. The only mechanism I know to share dependency management is the BOM. Is there
another one? I don't think so. If we can't use that mechanism to override versions (while
we can by adding the dependency directly), it looks like something is missing in Maven.

I am ok with whatever alternatives Maven offers that would allow me to share the dependency
management. I just don't think there is one.

> Dependency management in a child project cannot override a version using a BOM
> ------------------------------------------------------------------------------
>                 Key: MNG-5971
>                 URL:
>             Project: Maven
>          Issue Type: Wish
>          Components: Dependencies
>    Affects Versions: 3.3.3
>            Reporter: Stephane Nicoll
>            Priority: Trivial
>              Labels: close-pending
> When a project extends from a parent with a {{dependencyManagement}} section, it is not
always possible to properly override (and align) the version to use for a group of dependencies.
> We typically use Bill Of Materials to gather a group of modules and make sure their versions
are consistent. 
> The following project demonstrates the issue:
> The first commit is a working use case where the parent uses a bom with version A and
we use the same bom with version B in the child. Version B is used as expected.
> The second commit demonstrates the faulty scenario. Rather than using a bom in the parent,
we use a direct dependency (provided by that bom). We still use the bom with a different version.
In that case all the dependencies but the one provided by the parent are overridden (leading
to mixed versions for the dependencies provided by the BOM).
> It looks like the distance is still used to compute the version while the graph of dependencies
should be flatten at each step for a proper override. 
> Thoughts? Thanks!

This message was sent by Atlassian JIRA

View raw message