Skip to content

Pin empty MavenSettings in DependencyResolutionDiagnosticTest.maven()#178

Merged
timtebeek merged 1 commit into
mainfrom
tim/fix-maven-diagnostic-mirror-friendly
May 18, 2026
Merged

Pin empty MavenSettings in DependencyResolutionDiagnosticTest.maven()#178
timtebeek merged 1 commit into
mainfrom
tim/fix-maven-diagnostic-mirror-friendly

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented May 18, 2026

Summary

openrewrite/gh-automation#95 installs ~/.m2/settings.xml with <mirrorOf>*</mirrorOf> to route Maven through artifactory.moderne.ninja (avoiding HTTP 429 from Maven Central). The mirror rewrites every repository request — including the test pom's deliberately-unreachable <repository><url>https://nonexistent.moderne.io/maven2</url></repository> — so the diagnostic recipe only sees the mirror and the local file cache. Neither Maven Central nor the test repo appear in the data table; both contains(...) assertions fail.

Inject an explicit empty MavenSettings via MavenExecutionContextView (same pattern as the existing mavenSettingsWithMirrors test) so the recipe ignores ~/.m2/settings.xml and sees the pom-declared repositories directly. The original three assertions are restored unchanged.

Failing CI run: https://github.com/openrewrite/rewrite-java-dependencies/actions/runs/26053770256

Test plan

  • ./gradlew test --tests "org.openrewrite.java.dependencies.DependencyResolutionDiagnosticTest" passes locally
  • CI passes in this PR (with mirror)

openrewrite/gh-automation#95 installs ~/.m2/settings.xml with `<mirrorOf>*</mirrorOf>` to route Maven through `artifactory.moderne.ninja` and avoid HTTP 429 from Maven Central. The mirror rewrites every repository request — including the test pom's deliberately-unreachable `<repository><url>https://nonexistent.moderne.io/maven2</url></repository>` — so the diagnostic recipe only sees the mirror and the local file cache. Neither Maven Central nor the test repo appear in the data table, and both assertions fail.

Inject an explicit empty `MavenSettings` via `MavenExecutionContextView` (same pattern as `mavenSettingsWithMirrors`) so the recipe ignores `~/.m2/settings.xml` and sees the pom-declared repositories directly. The original three assertions are restored unchanged.
@timtebeek timtebeek force-pushed the tim/fix-maven-diagnostic-mirror-friendly branch from 936f585 to 521170c Compare May 18, 2026 19:20
@timtebeek timtebeek changed the title Make DependencyResolutionDiagnosticTest.maven() mirror-friendly Pin empty MavenSettings in DependencyResolutionDiagnosticTest.maven() May 18, 2026
@timtebeek timtebeek merged commit b655867 into main May 18, 2026
1 check passed
@timtebeek timtebeek deleted the tim/fix-maven-diagnostic-mirror-friendly branch May 18, 2026 19:24
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant