Skip to content

Check the diagnostic's report without naming Maven Central's or the plugin portal's URL - #206

Merged
jkschneider merged 1 commit into
mainfrom
jkschneider/diagnostic-test-any-mirror
Oct 24, 2026
Merged

jkschneider merged 1 commit into
mainfrom
jkschneider/diagnostic-test-any-mirror

Conversation

@jkschneider

Copy link
Copy Markdown
Member

DependencyResolutionDiagnosticTest asserted that the report lists https://repo.maven.apache.org/maven2 and https://plugins.gradle.org/m2 by URL. Which URL a build reaches them at depends on the machine: where CI names a mirror, as the Code Genome Project's builds do (MAVEN_CENTRAL_MIRROR_URL, and Maven settings that mirror everything through it), the mirror stands in for both. There gradle(), gradleNoDefaultRepos() and dependencyNotFound() failed; gradle() found 3 rows instead of 4, the mirror counting once for both Central and the portal.

  • The tests now check the repositories they declare by URL: the local repository, and nonexistent.moderne.io failing with an unknown host. Maven Central and the plugin portal they check only by being reachable, at whatever URL the machine reaches them.
  • maven() forced empty settings, so it always pinged Maven Central itself, and failed whenever Central refused the machine. It now mirrors only Central, through MAVEN_CENTRAL_MIRROR_URL when that is set, which keeps the pom's own repository visible; with no mirror named it keeps the empty settings.

Locally the class passes with and without MAVEN_CENTRAL_MIRROR_* set, 6 tests each.

…lugin portal's URL

Which URL a build reaches Maven Central and the Gradle Plugin Portal at depends on the machine. Where CI names a
mirror, as the Code Genome Project's builds do, the mirror stands in for both, and gradle(), gradleNoDefaultRepos()
and dependencyNotFound() failed there: gradle() found 3 rows instead of 4, the mirror counting once for both.

The tests now check the repositories they declare by URL, and Central and the plugin portal only by being reachable.
maven() forced empty settings, so it always pinged Maven Central itself; it now reaches Central through
MAVEN_CENTRAL_MIRROR_URL when that is set.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Oct 24, 2026
@jkschneider
jkschneider merged commit 8be85c5 into main Oct 24, 2026
2 checks passed
@jkschneider
jkschneider deleted the jkschneider/diagnostic-test-any-mirror branch October 24, 2026 21:27
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Oct 24, 2026
jkschneider added a commit that referenced this pull request Oct 25, 2026
… Central directly (#207)

Where CI names a mirror, as the Code Genome Project's builds do, two tests still reached
repo.maven.apache.org directly.

DependencyListTest#validateResolvable gives the recipe an LST whose only repository can't be
reached. Its xml() source loads no Maven settings, and the downloader adds Maven Central behind that
repository, so the test asked Central for com/test/test/maven-metadata.xml and its directory
listing, and got 404s. Its context now leaves out Central and the local repository, so the pretend
repository is the only one asked. The recipe still reports the MavenDownloadingException the test
checks for.

ModuleHasDependencyTest.WhenDependencyIsRequestedButNotResolved#mavenMatchesOnRequested forced empty
settings, which keep the machine's own out but name no mirror, so spring-beans 6.0.0 and the POMs it
needs came from Central directly. Like DependencyResolutionDiagnosticTest#maven since #206, it now
uses settings that mirror only Central through MAVEN_CENTRAL_MIRROR_URL, _USERNAME and _PASSWORD
when they are set, and the same empty settings when they are not. settingsMirroringOnlyCentral moves
from DependencyResolutionDiagnosticTest to MavenCentralMirror so that both tests can use it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant