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 摘要。