fix: use maven-metadata.xml to look up latest test framework version#1868
Open
wenytang-ms wants to merge 1 commit into
Open
fix: use maven-metadata.xml to look up latest test framework version#1868wenytang-ms wants to merge 1 commit into
wenytang-ms wants to merge 1 commit into
Conversation
The previous implementation queried search.maven.org's Solr endpoint and returned the `latestVersion` field. That index has been frozen since around May 2025 (a side effect of the Sonatype migration to central.sonatype.com), so the endpoint now serves stale data. For example, the latest version it reports for `junit-platform-console-standalone` is `1.13.0-M3` (a JUnit 5 milestone), while the actual current stable on Maven Central is `6.1.0`. As a result, `Enable Java Tests` ends up downloading either that milestone or, after falling back, the hard-coded `1.9.3`. Switch the lookup to the artifact's own `maven-metadata.xml` on repo1.maven.org, which is the authoritative metadata maintained alongside the artifact: * Prefer the `<release>` tag (Maven's pointer to the latest non-snapshot version). * Fall back to scanning `<version>` entries from newest to oldest for the first stable build. * Pre-release qualifiers (`-M*`, `-RC*`, `-beta`, `-SNAPSHOT`, etc.) are rejected via `isStableVersion`. Also bump the JUnit Jupiter `defaultVersion` from `1.9.3` to `6.1.0` so the offline fallback matches a currently published stable. Related to #1866 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Enable Java Testscurrently looks up the latest framework version throughsearch.maven.org's Solr API and reads thelatestVersionfield. That index has been frozen since around May 2025 (a side effect of Sonatype migrating Central tocentral.sonatype.com), so the response is stale.Concretely, for
org.junit.platform:junit-platform-console-standalonethe endpoint returns:{ "response": { "docs": [ { "latestVersion": "1.13.0-M3", ... } ] } }while Maven Central actually serves stable versions up to
1.14.4(Platform 1.x line) and6.1.0(Platform 6 line, maven-metadata.xml). The user-visible effect is the symptom reported in #1866 — the command downloads1.13.0-M3(a JUnit 5 milestone) or, after the fall-back, the hard-coded1.9.3.Change
Switch the lookup to
repo1.maven.org/.../maven-metadata.xml, which is the artifact's own metadata file and is always current:<release>tag (Maven's pointer to the latest non-snapshot version).<version>entries from newest to oldest for the first stable build.-M*,-RC*,-beta,-SNAPSHOT, …) via a simple^\d+(\.\d+)*$check.Also bump the JUnit Jupiter
defaultVersionfallback from1.9.3to6.1.0so the offline path matches a currently published stable.Verification
Manual end-to-end:
Enable Java Tests→ JUnit Jupiter now downloadsjunit-platform-console-standalone-6.1.0.jar(was1.13.0-M3or1.9.3).…-6.1.0.jar.npm run lintandnpm run compileclean.Notes
NoClassDefFoundError: CancellationToken) is deferred to upstream JDT (eclipse.jdt.ui#2910 /17f8fa5d9f) and will land via the next JDT-LS server bump; see the tracking comment on [Tracking] Defer JUnit 5/6 dispatch fix to upstream JDT (do not merge) #1867. This PR therefore only addresses the download half.Enable Java Testsflow only runs forProjectType.UnmanagedFolder, which in practice inherits the JDT-LS tooling JRE (Java 21+), so JUnit 6's JDK 17 baseline is met by default.Related to #1866