NativeScript / NativeScript/nativescript-cli

OpenJDK 18 - JAVAC Fails this check

未關閉
#5,668 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 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
  1. Install Ubuntu 22.04,
  2. install OpenJDK 18,
  3. install NativeScript,
  4. 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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 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

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。