Search code examples
javagradleminecraftminecraft-fabric

FAILURE: Build failed with an exception when running gradle build


I wanted to compile a Minecraft Mod from this Github Page: https://github.com/arm32x/command-block-ide

So I opened the folder in Visual Studio code and run in the Terminal: gradle build After that I got the following error:

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

All what I wanted was the code to compile and get the .jar file out of it. Thank you very much for your Help!

I installed Gradel manually with home-brew on my MacBook an searched in the Internet. Badly, I couldn't find a solution to Fix the problem.


Solution

  • Building any Java project requires a JDK, different from JRE which is only capable of executing code.

    OpenJDK distributions are available from many sources. Here are downloads from Eclipse Adoptium (formerly AdoptOpenJDK):

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

    You should download the “AArch64” .pkg for Late 2020 and later Mac models, or the “x64” .pkg otherwise or if you don't know.