Fix Maven cache warmer to cache surefire-junit-platform provider#1513
Merged
Conversation
The warm-cache workflow pre-populates ~/.m2 so forked PRs can build in offline mode. It relied on its filtered test steps (4-6) to lazily pull the Surefire JUnit Platform provider (surefire-junit-platform), but those steps fail early with "No tests matching pattern" (no compiled test classes), masked by `|| true`. Surefire prints "No tests to run" and never loads the provider, so the jar is never cached. Forked PR jobs then fail in offline mode with: surefire-junit-platform:jar:3.1.2 (absent): Cannot access central ... in offline mode Add an explicit `dependency:get` for the provider so it is cached deterministically regardless of whether any filtered test run executes. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
sreekanth-db
approved these changes
Jun 29, 2026
The warmer saved caches as maven-deps-<timestamp>-<hash>, but consumers restore with exact key maven-deps-<hash> and fall back to the unscoped prefix restore-keys: maven-deps-. The timestamp segment means the exact key never matches, so restore always fell through to the prefix — which GitHub resolves to the most-recently-created maven-deps-* entry across ALL poms, frequently a main-branch cache that lacks fork-specific artifacts (and, before the prior commit, the surefire-junit-platform provider). Result: fork PRs restored the wrong cache and failed offline. Fix: - Warmer key layout -> maven-deps-<hash>-<timestamp> (hash first). - Consumer restore-keys -> maven-deps-<hash> (hash-scoped prefix), so the fallback only matches caches warmed for the same pom and picks the newest by timestamp. Requires a fresh warmer run after merge so caches are saved under the new key layout; old maven-deps-<timestamp>-<hash> entries no longer match and expire after 7 days. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Forked PRs (e.g. #1507) run Maven in offline mode against the
~/.m2cache pre-populated by the Warm Maven Dependency Cache workflow. They fail with:This breaks every test job (unit / integration / coverage, all JDK + OS combinations) on fork PRs.
Root cause
The warmer relies on its filtered test steps (4–6) to lazily download the Surefire JUnit Platform provider (
surefire-junit-platform). But those steps fail early withNo tests matching pattern "..."— there are no compiled test classes for the narrow-Dtest=filters to match, so Surefire printsNo tests to runand never loads (or downloads) the provider. The failures are masked by|| true, so the warmer reports success while saving a cache that is missing the provider jar.Verified in the most recent warm run:
surefire-junit-platformappears 0 times in the warmer log on both Linux and Windows.Fix
Add an explicit
dependency:getfororg.apache.maven.surefire:surefire-junit-platform(version read from themaven-surefire-plugin.versionPOM property, falling back to3.1.2) so the provider is cached deterministically, independent of whether any filtered test run executes.Follow-ups (not in this PR)
|| true) — the warmer's unit-test steps aren't actually exercising tests and should be fixed to compile + run real tests.NO_CHANGELOG=true
This pull request and its description were written by Isaac.