redhat-developer / redhat-developer/vscode-java
Can not build gradle project with jdk 17
未关闭
还没有人认领这个 Issue。
Gradle
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 546
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
My project requires jdk 17 to build. I use jenv to manage jdk and I set it to use java 17 locally but it seems the extension always use 21 to build project. I can build the project successfully in the terminal. I think the extension should use the java configured in java_home to build the project.
java home:
echo $JDK_HOME
/Users/user/.jenv/versions/17
Error log:
[info] [gradle-server] Gradle Server started, listening on 52563
[info] Gradle client connected to server
[info] Java Home: /Users/user/.cursor/extensions/redhat.java-1.43.1-darwin-arm64/jre/21.0.7-macosx-aarch64
[info] JVM Args: --add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=en,-Duser.variant
[info] Gradle User Home: /Users/user/.gradle
[info] Gradle Version: 7.6.4
[error] FAILURE: Build failed with an exception.
I tried to add the config below but still not working
"java.configuration.runtimes": [
{
"name": "JavaSE-17",
"path": "/Users/user/.jenv/versions/17",
"default": true
}
],
"gradle.java.home": "/Users/user/.jenv/versions/17"
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从错误日志中显示的 Gradle Server 启动和 Java Home 处理开始,然后跟踪如何读取 java.configuration.runtimes 和 gradle.java.home。使用 jenv 和 JDK 17 进行复现,同时让 Gradle 报告捆绑的 JDK 21;当项目能够使用配置的 JDK 17 构建时即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- build-system, devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100