Repository navigation
fix(windows): Maven compile uses project/Maven JDK instead of env JDK (#1216) - #1537
Closed
lithe-claude-coding[bot] wants to merge 2 commits into
Closed
lithe-claude-coding[bot] wants to merge 2 commits into
lithe-claude-coding[bot] wants to merge 2 commits into
Conversation
…#1216) Windows Maven sidebar compile resolved a Maven JDK (Maven setting, Run Maven JDK, or Run project JDK) but run_resolve_launch then kept the automatic JDK in JAVA_HOME via or_insert, so an env JDK 1.8 silently shadowed a configured JDK 21. For a Maven launch with an explicitly configured Maven JDK, the resolved Maven JDK now overwrites JAVA_HOME; with no Maven JDK configured, the previous precedence is unchanged. Adds a Rust regression test for both cases. Windows real-machine verification is pending.
lithe-claude-coding
Bot
requested review from
1lck,
Mucheen and
xiaoyumuxi
as code owners
October 27, 2026 11:28
Lithe Review结论: ⛔ 有阻塞 Findings
Scope Check
Suggestions
Summary修复命中了 Maven 侧栏的环境优先级问题,但将覆盖行为扩展到了所有启动类型,造成非 Maven 构建回归。新增测试具备失败时清理临时目录的机制,但未覆盖这条关键隔离边界。 Verification
|
PR #1537 P1 review: run_resolve_launch previously overwrote JAVA_HOME with a configured Maven JDK for every launch, so a non-Maven task (project JDK 21, Maven JDK 8, e.g. Gradle 9) would silently run under JDK 8. Gate the override on executable.toolchain == "project-maven". Non-Maven launches keep project JDK and explicit environment priority. Add regression test non_maven_launch_keeps_project_jdk_over_configured_maven_jdk: project JDK 21 + Maven JDK 8 + project-jdk executable -> JAVA_HOME 21; explicit environment JAVA_HOME still wins. Existing Maven cases unchanged: Maven JDK 21 wins, Maven empty -> automatic/project JDK. Windows real-machine verification still pending; Rust tests and cargo fmt could not run on this Linux VM (no cargo/rustc) and must run in CI/Windows.
Author
|
P1 已修复(新提交 177ca61,仍在同一分支 bot/issue-1216-maven-jdk):
未宣称已通过的验证:本机 Linux VM 无 cargo/rustc,Rust 测试和 cargo fmt 未能在此运行,需 CI/Windows 运行;Windows 真机 Maven/Gradle 实际行为仍待验证,PR 仍为 open、未合并。 |
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.
Fixes #1216.
Source Issue
#1216: Windows Maven sidebar compile uses the machine env JDK (reporter: env JDK 1.8) instead of the configured project/Maven JDK (21).
Root cause (brief)
The TypeScript Maven launch layer resolves a Maven JDK (Maven setting -> Run Maven JDK -> Run project JDK), but
windows/tauri/src-tauri/src/run.rsrun_resolve_launchthen kept the automatic JDK inJAVA_HOMEviaentry().or_insert(). A resolved automatic JDK therefore silently shadowed a configured Maven JDK. The automatic JDK itself also prefers envJAVA_HOME, which is why 1.8 won.Minimal fix
windows/tauri/src-tauri/src/run.rsrun_resolve_launch: for a Maven launch with an explicitly configured Maven JDK, the resolved Maven JDK now overwritesJAVA_HOME. With no Maven JDK configured, the previous precedence is unchanged (explicit environmentJAVA_HOME, then automatic/project JDK, then inherited env).select_java.maven_launch_uses_configured_maven_jdk_over_automatic_jdk: automatic JDK 1.8 + Maven JDK 21 ->JAVA_HOMEis 21; Maven JDK empty ->JAVA_HOMEis the automatic/project JDK.windows/tauri/src-tauri/src/run.rsto the Windows evidence ofjava-maven-project-settings(implementation alreadyimplemented, verification remainspending). The mocked TypeScript testmaven-project-jdk.test.tsis NOT cited as coverage for this Rust change.Linux code-level verification done
git diffis only the two intended files above, no secrets, no unrelated changes, no media files../scripts/verify-platform-feature-matrix-change.sh origin/preview HEAD: passed../scripts/verify-platform-feature-matrix.sh: passed, 209 capabilities validated../.agents/skills/write-stable-tests/scripts/verify-test-stability.sh: passed.cargo fmt --checkand the new Rust test could NOT be run on this Linux VM: cargo/rustc, Java, and Maven are not installed here, and the Tauri host crate is a Windows test target (cargo test --manifest-path windows/tauri/src-tauri/Cargo.tomlon Windows). Do not treat those as passed; CI / a Windows runner must run them.Not verified on a real Windows machine
This PR is NOT verified on a real Windows machine. Still needed on Windows before merge:
mvn -versionreports JDK 21 and compilation succeeds against 21 APIs.mvnwprojects and multi-module-pl/-amgoals are unaffected.resolve_java_homenow fails the launch with a clear message instead of silently compiling under 1.8; call that out in review.Draft PR only, do not merge, do not mark ready until Windows verification and CI Rust tests pass.