apache / apache/maven

[MNG-6575] make Dependency immutable

Open
#8,672 9 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Hervé Boutemy](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=hboutemy)** opened **[MNG-6575](https://issues.apache.org/jira/browse/MNG-6575?redirect=false)** and commented

while working on Maven memory consumption issue MNG-6571, once VersionRange is made immutable, memory used was divided by 2: the next big expected win is to make Dependency immutable, which would probably once again divide memory by 2 because the vast majority of time, dependencies (be it in dependencyManagement or base dependencies) are inherited without any modification

this will require to change [ModelMerger](https://maven.apache.org/ref/3.6.0/maven-model/apidocs/org/apache/maven/model/merge/ModelMerger.html) 's `mergeDependency(Dependency target, Dependency source, boolean sourceDominant, Map context)` signature, since is not really an immutable friendly signature
and also make [Dependency code](https://maven.apache.org/ref/3.6.0/maven-model/apidocs/org/apache/maven/model/Dependency.html) immutable (generated by Modello)

---

**Affects:** 3.6.0

**Attachments:**
- [dump-with-mng-6571-fixes.png](https://issues.apache.org/jira/secure/attachment/12958554/dump-with-mng-6571-fixes.png) (_111.16 kB_)
- [dump-with-wrapper-approach.png](https://issues.apache.org/jira/secure/attachment/12958553/dump-with-wrapper-approach.png) (_82.50 kB_)
- [MNG-6575-maven-model.patch](https://issues.apache.org/jira/secure/attachment/12958673/MNG-6575-maven-model.patch) (_18.86 kB_)

**Issue Links:**
- [MNG-6571](https://issues.apache.org/jira/browse/MNG-6571) Maven memory consumption issue

0 votes, 5 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.