Spring框架构建错误:找不到Java工具链

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

我正在尝试从源代码构建 Spring 框架,但在从 IntelliJ 构建它时遇到了有关 Java 工具链的问题。这是我收到的错误消息:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':integration-tests'.
> Failed to calculate the value of task ':integration-tests:compileJava' property 'javaCompiler'.
   > Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=BellSoft Liberica, implementation=vendor-specific} for WINDOWS on x86_64.
      > No matching toolchain could be found in the locally installed toolchains or the configured toolchain download repositories. Some toolchain resolvers had provisioning failures: foojay (Unable to download toolchain matching the requirements ({languageVersion=17, vendor=BellSoft Liberica, implementation=vendor-specific})

我已经安装了 Java 17 并将变量 JAVA_HOME 设置为指向安装。

我对 Gradle 工具链配置需要做什么感到很迷茫,而且文档并没有让我更清楚。

我非常感谢您提供的任何指导。

我使用的是从oracle网站下载的Java 17.0.11。

spring gradle
1个回答
0
投票

请参考这个gradle问题

决议已在此处

配置 foojay 解析器插件

  plugins {
      id("org.gradle.toolchains.foojay-resolver") version "0.4.0"
  }

  toolchainManagement {
      jvm {
          javaRepositories {
              repository("foojay") {
                  resolverClass.set(org.gradle.toolchains.foojay.FoojayToolchainResolver::class.java)
              }
          }
      }
  }
© www.soinside.com 2019 - 2024. All rights reserved.