apache / apache/maven

[MNG-5971] Imported dependencies should be available to inheritance processing

Open
#7,729 36 comments 0 reactions 0 assignees View on GitHub
bug priority:trivial
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Stephane Nicoll](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=snicoll)** opened **[MNG-5971](https://issues.apache.org/jira/browse/MNG-5971?redirect=false)** and commented

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: https://github.com/snicoll-scratches/maven-dependency-management

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!

---

**Affects:** 3.3.3

**Attachments:**
- [bom-cloud.zip](https://issues.apache.org/jira/secure/attachment/12789196/bom-cloud.zip) (_50.23 kB_)

**Issue Links:**
- [MNG-5547](https://issues.apache.org/jira/browse/MNG-5547) import scope of dependencyManagement doesn't seem to work
(_**"is duplicated by"**_)
- [MNG-5947](https://issues.apache.org/jira/browse/MNG-5947) dependencyManagement import section does not resolve dependencies using "nearest" definition
(_**"is duplicated by"**_)
- [MNG-6246](https://issues.apache.org/jira/browse/MNG-6246) Inconsistent override behaivor with BOM vs dependency
(_**"is duplicated by"**_)
- [MNG-6161](https://issues.apache.org/jira/browse/MNG-6161) Dependencies' management via \import\ should take precedence over inherited definitions
(_**"is duplicated by"**_)
- [MNG-5947](https://issues.apache.org/jira/browse/MNG-5947) dependencyManagement import section does not resolve dependencies using "nearest" definition

- [MNG-5982](https://issues.apache.org/jira/browse/MNG-5982) The POM for ... is invalid, transitive dependencies ... while property was overriden

- [MNG-7852](https://issues.apache.org/jira/browse/MNG-7852) Use all the versions for dependency resolution rather than "nearest first" or "declared first"

- [MNG-6079](https://issues.apache.org/jira/browse/MNG-6079) 3.4 regression: cannot override version of a dependencyManagement in a submodule any more
(_**"supercedes"**_)

**Remote Links:**
- [Page
](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=67636510)

6 votes, 20 watchers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.