Visitar URL original
fix(java): resolve lockfile URLs from metadata by risu729 · Pull Request #9719 · jdx/mise · GitHub
Skip to content

fix(java): resolve lockfile URLs from metadata - #9719

Merged
jdx merged 3 commits into
jdx:mainfrom
risu729:fix-java-lock-url
May 10, 2026
Merged

jdx merged 3 commits into
jdx:mainfrom
risu729:fix-java-lock-url

Conversation

@risu729

@risu729 risu729 commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Java didn't work when I tried to install tools from the lockfile newly created with mise lock by mise install --locked.

Summary

  • resolve core:java lockfile URL/checksum data directly from the mise Java metadata API
  • make Java metadata resolution target-platform aware so mise lock --platform can record non-host assets such as Windows ZIPs
  • keep Java release_type in lockfile matching and cover mise install --locked --dry-run from a freshly generated lockfile

Testing

  • mise run test:e2e e2e/core/test_java_lockfile
  • mise run lint

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements lockfile support for the Java core plugin, enabling cross-platform resolution of Java versions. Key changes include refactoring metadata fetching to be platform-aware, implementing resolve_lockfile_options and resolve_lock_info, and adding an E2E test. Feedback identifies a bug where string conversion of TOML values includes extra quotes and suggests using Platform::current() instead of a redundant helper. Additionally, it is recommended to implement caching for cross-platform metadata requests to improve performance.

Comment thread src/plugins/core/java.rs Resolved
Comment thread src/plugins/core/java.rs Resolved
Comment thread src/plugins/core/java.rs Resolved
Comment thread src/plugins/core/java.rs Resolved
Comment thread src/plugins/core/java.rs Resolved
@greptile-apps

greptile-apps Bot commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates core:java lockfile generation to resolve download URLs and checksums directly from the mise Java metadata API, making the process platform-aware so mise lock --platform can record assets for non-host platforms (e.g., Windows ZIPs from a Linux host). It also preserves release_type in locked options and adds an e2e test.

  • Adds fetch_java_metadata_for_target with an in-memory tokio::sync::Mutex-backed cache keyed by (release_type, platform_key), reusing the existing CacheManager-backed host cache when the target matches the host platform.
  • Refactors download_java_metadata, java_os, java_arch, and the file-type filter to be Platform-aware instead of relying on compile-time or host-only globals, and extracts to_version_string(&Platform) from Display for clean cross-platform key generation.
  • Implements resolve_lock_info and resolve_lockfile_options on the Backend trait for JavaPlugin, covering mise install --locked --dry-run from a fresh lockfile without requiring a prior install.

Confidence Score: 5/5

Safe to merge — changes are well-scoped to Java metadata fetching and lockfile generation with no impact on the install or version-listing hot paths for users who don't use mise lock.

The core refactoring (platform-aware metadata fetch, to_version_string, file-type filter) correctly handles all platform branches including musl, FreeBSD host, Windows cross-lock, and the host-cache reuse shortcut. The tokio::sync::Mutex in-memory cache prevents redundant HTTP round-trips within a single invocation. The e2e test exercises both the host and cross-platform (Windows) lock paths plus the --locked --dry-run flow.

No files require special attention.

Important Files Changed

Filename Overview
src/plugins/core/java.rs Substantial refactor adding platform-aware metadata fetching, per-process in-memory caching, and Backend trait implementations for lockfile resolution; logic is sound and edge cases (musl, cross-platform) are correctly handled.
e2e/core/test_java_lockfile New e2e test verifying lockfile generation for both the current platform and a cross-platform Windows target, including a --locked --dry-run smoke-test.

Reviews (4): Last reviewed commit: "test(java): handle musl in lockfile e2e" | Re-trigger Greptile

Comment thread src/plugins/core/java.rs Resolved
Comment thread src/plugins/core/java.rs Resolved
@risu729

This comment was marked as outdated.

@risu729

This comment was marked as outdated.

@risu729

risu729 commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

@roele Sorry for pinging. Are there any reasons the mise lock was not supported for Java?
I think I still need to fix this PR, but I would like to know if I'm not missing something important here.

@roele

roele commented May 9, 2026

Copy link
Copy Markdown
Contributor

@risu729 Not that i am aware of. Even though Java might be a bit less prone to incompatibilities between minor or even major versions, pinning still might be helpful.

@risu729

risu729 commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

I see, thanks! I just hit this while using mise lock and mise install --locked, but it's not a standard workflow.

@risu729
risu729 force-pushed the fix-java-lock-url branch from 6f18c29 to 8ee2bc3 Compare May 9, 2026 16:44
@risu729
risu729 marked this pull request as ready for review May 9, 2026 16:59
@jdx
jdx merged commit 0d34044 into jdx:main May 10, 2026
34 checks passed
@risu729
risu729 deleted the fix-java-lock-url branch May 10, 2026 13:28
mise-en-dev added a commit that referenced this pull request May 11, 2026
### 🚀 Features

- **(cli)** add minimum release age flag to lock and ls-remote by
@risu729 in [#9269](#9269)
- **(config)** add run field for hooks by @risu729 in
[#9718](#9718)
- **(github)** add native oauth token source by @jdx in
[#9654](#9654)
- **(oci)** scope build to project config by default by @jdx in
[#9766](#9766)
- add support for prefixed latest version queries in outdated checks by
@roele in [#9767](#9767)

### 🐛 Bug Fixes

- **(activate)** guard bash chpwd hook under nounset by @risu729 in
[#9716](#9716)
- **(backend)** date-check latest stable fast path by @risu729 in
[#9650](#9650)
- **(config)** parse core tool options consistently by @risu729 in
[#9742](#9742)
- **(exec)** propagate __MISE_DIFF so nested mise recovers pristine PATH
by @jdx in [#9765](#9765)
- **(forgejo)** include prereleases when opted in by @risu729 in
[#9717](#9717)
- **(github)** avoid caching empty release assets by @risu729 in
[#9616](#9616)
- **(java)** resolve lockfile URLs from metadata by @risu729 in
[#9719](#9719)
- **(lock)** cache unavailable github attestations by @risu729 in
[#9741](#9741)
- **(pipx)** preserve options when reinstalling tools by @risu729 in
[#9663](#9663)
- **(python)** skip redundant lockfile provenance verification by
@risu729 in [#9739](#9739)
- **(vfox)** run pre_uninstall hook by @risu729 in
[#9662](#9662)

### 🚜 Refactor

- **(schema)** extract tool options definition by @risu729 in
[#9649](#9649)

### ⚡ Performance

- **(aqua)** bake rkyv aqua package blobs by @risu729 in
[#9535](#9535)

### 📦️ Dependency Updates

- lock file maintenance by @renovate[bot] in
[#9773](#9773)

### 📦 Registry

- add vector
([github:vectordotdev/vector](https://github.com/vectordotdev/vector))
by @kquinsland in [#9761](#9761)
- add oc and openshift-install (http backend) by @konono in
[#9669](#9669)

### New Contributors

- @konono made their first contribution in
[#9669](#9669)
- @kquinsland made their first contribution in
[#9761](#9761)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants