Skip to content

Resolve parent and imported POMs from repositories declared in the POM chain - #562

Merged
slachiewicz merged 1 commit into
mojohaus:masterfrom
dodoshell:fix-561-model-resolver-repositories
Nov 8, 2026
Merged

slachiewicz merged 1 commit into
mojohaus:masterfrom
dodoshell:fix-561-model-resolver-repositories

Conversation

@dodoshell

Copy link
Copy Markdown
Contributor

FlattenModelResolver.addRepository was a no-op, so a parent POM or an imported BOM was only looked up in the project's remote repositories, never in a repository declared by a POM further down the chain. Maven core builds such a model fine, and flatten then fails to rebuild it.

  • addRepository adds the repository after the project's ones, or replaces it by id when replace is set, as Maven's ProjectModelResolver does. The settings' mirrors, proxies and authentication are applied through RepositorySystem.newResolutionRepositories, so no new dependency is needed; a repository whose mirror is already in the list is not added again.
  • newCopy() copies the list, so repositories from one imported BOM don't leak into the resolution of another.
  • CreateEffectivePomTest passes the container's RepositorySystem instead of null, since the model builder now reaches it for the super POM's central.

Verified: the new FlattenModelResolverTest fails without the change (4 tests), and mvn -P run-its verify passes.

Fixes #561

…M chain

FlattenModelResolver ignored the repositories that a parent POM or an
imported BOM declares, so flatten could not rebuild a model that Maven
core had built, such as a BOM whose parent is only in a repository the
BOM declares. Add them to the requests the way Maven's model resolvers
do, with the settings' mirrors applied, and give each copy of the
resolver its own list.

Fixes mojohaus#561
@slachiewicz slachiewicz added the bug Something isn't working label Nov 6, 2026
@slachiewicz

Copy link
Copy Markdown
Member

Thank you @dodoshell for this fix! Resolving parent and imported POMs from repositories declared in the POM chain addresses #561 cleanly with proper policy conversion and mirror/proxy support. I have added the bug label to trigger CI verification.

@slachiewicz
slachiewicz merged commit 2a63e6d into mojohaus:master Nov 8, 2026
12 checks passed
@github-actions github-actions Bot added this to the 1.9.1 milestone Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model resolver ignores repositories declared in parent and imported POMs

2 participants