FAILURE:运行 gradle build 时构建失败并出现异常

问题描述 投票:0回答:1

我想从这个 Github 页面编译一个 Minecraft Mod:https://github.com/arm32x/command-block-ide

所以我在 Visual Studio code 中打开该文件夹并在终端中运行:

gradle build
之后我收到以下错误:

command-block-ide % gradle build
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :
Fabric Loom: 1.3.9
Found existing cache lock file, rebuilding loom cache. This may have been caused by a failed or canceled build.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'command-block-ide'.
> Could not resolve all dependencies for configuration ':mappings'.
   > Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
      > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for MAC_OS on x86_64.
         > No locally installed toolchains match and toolchain download repositories have not been configured.

* Try:
> Learn more about toolchain auto-detection at https://docs.gradle.org/8.4/userguide/toolchains.html#sec:auto_detection.
> Learn more about toolchain repositories at https://docs.gradle.org/8.4/userguide/toolchains.html#sub:download_repositories.
> 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.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 26s

我想要的只是编译代码并从中获取 .jar 文件。 非常感谢您的帮助!

我在 MacBook 上使用 home-brew 手动安装了 Gradel,并在互联网上搜索。糟糕的是,我找不到解决问题的方法。

java gradle minecraft minecraft-fabric
1个回答
0
投票

构建任何 Java 项目都需要 JDK,与只能执行代码的 JRE 不同。

OpenJDK 发行版可以从许多来源获得。以下是从 Eclipse Adoptium(以前称为 AdoptOpenJDK)的下载:

https://adoptium.net/temurin/releases/?os=mac&package=jdk&version=17

您应该下载适用于 2020 年末及更高版本 Mac 型号的“AArch64”.pkg,或者如果您不知道则下载“x64”.pkg。

© www.soinside.com 2019 - 2024. All rights reserved.