NativeScript / NativeScript/nativescript-cli
OpenJDK 18 - JAVAC Fails this check
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 1.1k
- 分支
- 204
- 平均合併
- 1 天 9 小時
- 30 天內合併 PR
- 8
描述
Issue Description
ns doctor or ns build android will fail on later versions of OpenJDK installations (basically failing to detect that it is installed, because the version check fails to get a number version). Giving you an error message about javac not installed or JAVA_HOME not being set.
This line has the failing regex.
https://github.com/NativeScript/nativescript-cli/blob/e44ca94cce733be5925988d07a8f99e0acc692c9/packages/doctor/src/sys-info.ts#L15
Replaced in my local copy with:
SysInfo.JAVA_COMPILER_VERSION_REGEXP = /^javac (\d*)/im;
Changed the (.*) to (\d*) meaning grab all numbers...
Reproduction
- Install Ubuntu 22.04,
- install OpenJDK 18,
- install NativeScript,
- run
NS doctor
Relevant log output (if applicable)
No response
Environment
echo $JAVA_HOME -> /usr/lib/jvm/java-18-openjdk-amd64
javac -version -> javac 18-ea
OS: Linux 5.17 Pop!_OS 22.04 LTS
Shell: /bin/bash
node: 16.15.0
npm: 8.5.5
nativescript: 8.2.3
android
java: javac 18-ea
ndk: Not Found
apis: 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
build_tools: 30.0.0, 30.0.3, 33.0.0, 33.0.0
Please accept these terms
- I have searched the existing issues as well as StackOverflow and this has not been posted before
- This is a bug report
- I agree to follow this project's Code of Conduct
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 packages/doctor/src/sys-info.ts 中失敗的 Java 編譯器版本正規表示式開始。執行 ns doctor 或 ns build android,在 OpenJDK 18 下重現此問題,然後確認 javac 18-ea 會被偵測到,而不是被回報為缺少。當版本檢查能針對此輸出正常運作,且不會讓現有的 Java 偵測發生回歸時,此 issue 即完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java, typescript
- 領域
- cli
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 48/100