= 创作分享 =
编程开发
Gradle构建失败
丘啵啵

Gradle构建失败

丘啵啵 于 2025-1-10 19:50 ( 7天前 ) [复制链接] [只看楼主] [打印]
188 3
使用moarfps的源代码构建失败,提示使用了java8,但是我设置的就是java17,为什么?日志:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Downloading https://services.gradle.org/distributions/gradle-7.4-bin.zip
...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%

Welcome to Gradle 7.4!

Here are the highlights of this release:
- Aggregated test and JaCoCo reports
- Marking additional test source directories as tests in IntelliJ
- Support for Adoptium JDKs in Java toolchains

For more details see https://docs.gradle.org/7.4/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Onion\Downloads\moarfps-main\build.gradle' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'fabric-loom', version: '0.12-SNAPSHOT']
> Failed to apply plugin 'fabric-loom'.
   > You are using an outdated version of Java (8). Java 17 or higher is required.
     The JAVA_HOME environment variable is currently set to (C:\Users\Onion\.jdks\corretto-1.8.0_432).

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 19s

发表于 2025-1-10 19:50:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

回复 | 举报

该帖共收到 3 条回复!
丘啵啵
这个是运行了gradlew.bat clean的,gradlew.bat build的报错在这里:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Downloading https://services.gradle.org/distributions/gradle-7.4-bin.zip
...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%

Welcome to Gradle 7.4!

Here are the highlights of this release:
- Aggregated test and JaCoCo reports
- Marking additional test source directories as tests in IntelliJ
- Support for Adoptium JDKs in Java toolchains

For more details see https://docs.gradle.org/7.4/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Onion\Downloads\moarfps-main\build.gradle' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'fabric-loom', version: '0.12-SNAPSHOT']
> Failed to apply plugin 'fabric-loom'.
   > You are using an outdated version of Java (8). Java 17 or higher is required.
     The JAVA_HOME environment variable is currently set to (C:\Users\Onion\.jdks\corretto-1.8.0_432).

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 19s

C:\Users\Onion\Downloads\moarfps-main>gradlew.bat build
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Onion\Downloads\moarfps-main\build.gradle' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'fabric-loom', version: '0.12-SNAPSHOT']
> Failed to apply plugin 'fabric-loom'.
   > You are using an outdated version of Java (8). Java 17 or higher is required.
     The JAVA_HOME environment variable is currently set to (C:\Users\Onion\.jdks\corretto-1.8.0_432).

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
发表于 2025-1-10 19:51:59 | 只看该作者

回复 | 举报

|OMO
遇到过这个奇葩问题,只不过是用Java8却提示JAVA HONE指向Java17,但忘记怎么解决的了(悲),你这个情况好像是Java17那里的lib下缺tools.jar了或者Java8的lib下多了tools.jar,这个确实挺离谱的,网上一搜全是说系统变量JAVA_HOME有问题,但我这压根没有这个系统变量,并且配置JAVA_HOME也解决不了这个问题
发表于 6 天前 | 只看该作者

回复 | 举报

|OMO
QQ酱981479 发表于 2025-1-12 00:38
遇到过这个奇葩问题,只不过是用Java8却提示JAVA HONE指向Java17,但忘记怎么解决的了(悲),你这个情况好 ...

还有一种可能是我当时把JAVA_HOME删到只剩Java8的jdk并把最后面的";"给删了才搞定的
发表于 4 天前 | 只看该作者

回复 | 举报

百科目前不允许匿名发帖哦~ 请先 [ 登陆 ][ 注册 ] 吧~

本版积分规则

发新帖
  • 回复
  • 点评
  • 评分

[ MC百科(mcmod.cn) 除另有声明,所有开放公共编辑的内容均使用 BY-NC-SA 3.0 协议 ]

Minecraft百科CC协议
快速回复 返回顶部 返回列表