Skip to content

Fix Maven settings repos lost when context repos set independently#7208

Draft
Jenson3210 wants to merge 1 commit intomainfrom
Jenson3210/maven-download-failure
Draft

Fix Maven settings repos lost when context repos set independently#7208
Jenson3210 wants to merge 1 commit intomainfrom
Jenson3210/maven-download-failure

Conversation

@Jenson3210
Copy link
Copy Markdown
Contributor

@Jenson3210 Jenson3210 commented Mar 31, 2026

Summary

  • When MavenSettings was non-null, getRepositories(MavenSettings, List<String>) re-derived repos exclusively from settings profiles, ignoring any repos set directly on the context via setRepositories().
  • This caused download failures when repositories were configured independently of settings profiles — only the POM repo was tried, and settings/context repos were silently dropped.
  • Now both settings-derived repos and context repos are included, with settings repos taking precedence by ID.

Test plan

  • Added settingsReposUsedWhenPomRepoFails — verifies settings profile repos are used when POM repo fails

  • Added contextReposUsedWhenPomRepoFails — verifies context repos are used when POM repo fails (no settings)

  • Added contextReposNotLostWhenMavenSettingsPresentthe reproducer: verifies context repos set after setMavenSettings() are not lost (was failing before fix)

  • Existing repositoryOrder test still passes

  • Full rewrite-maven test suite passes

  • Fixes https://github.com/moderneinc/customer-requests/issues/2122

When MavenSettings was non-null, getRepositories(MavenSettings, List)
re-derived repos exclusively from settings profiles, ignoring any repos
set directly on the context via setRepositories(). This caused download
failures when repos were configured independently of settings profiles.

Now both settings-derived repos and context repos are included, with
settings repos taking precedence by ID.

Fixes moderneinc/customer-requests#2122
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Mar 31, 2026
@Jenson3210 Jenson3210 marked this pull request as draft March 31, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant