gnodet commented on PR #12653: URL: https://github.com/apache/maven/pull/12653#issuecomment-5457176665
## Fix for `MavenITmng4403LenientDependencyPomParsingTest` failure **Root cause:** The refactored `computeMergedDependencies()` method used two separate maps — `originalDeps` for lookups and `builderDeps` for results. When duplicate managed dependency declarations exist for the same key (MNG-4005 scenario), each merge always started from the **original** unmodified dependency, causing the last managed declaration to overwrite earlier values. In the master code, a single `dependencies` map was updated in place after each merge, so subsequent managed deps for the same key merged against the **already-merged result** — preserving "first declaration wins" semantics (target dominates when `sourceDominant=false`). **In the mng4403 test:** Dependency `c` had two managed declarations: 1. `c:0.1` scope=compile (first — should win) 2. `c:0.2` scope=test with exclusions (second — should only add exclusions, not override version/scope) Without the fix: the second declaration overwrote the first → `c:0.2` → unresolvable → `c` dropped from artifacts. **Fix (commit 394b9f2):** Before merging with a managed dep, check if a previous merge result exists in `builderDeps` for that key. If so, build it and use it as the target instead of the original — matching master's incremental merge behavior. All 574 maven-impl tests and 612 maven-core tests pass locally. 🤖 _Claude Code on behalf of gnodet_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
