Spring Boot 3.x 升级。无法解析 org.springframework.boot:spring-boot-gradle-plugin:3.0.1

2024-01-09

我最近想将我的 kotlin 项目从 spring boot 2.7.x 升级到 3.0.1。我使用 Java 17 temurin,gradle 7.6。在 IntelliJ 中,我在通过 gradle 导入项目时收到以下错误消息:

A problem occurred configuring root project 'demo'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.1.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.1
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.1 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.6' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.1 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')

我还尝试从 start.spring.io 下载类似的项目框架。使用以下 build.gradle.kts:

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    id("org.springframework.boot") version "3.0.1"
    id("io.spring.dependency-management") version "1.1.0"
    kotlin("jvm") version "1.7.22"
    kotlin("plugin.spring") version "1.7.22"
}

group = "com.example"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_17

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

tasks.withType<KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs = listOf("-Xjsr305=strict")
        jvmTarget = "17"
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

但导入项目时的错误消息仍然相同。有任何想法吗?


我看到您正在为此使用 IntelliJ IDEA。这对我有用:转到设置 --> 构建、执行、部署 --> 构建工具 --> Gradle。单击“Gradle 项目”下的 gradle 项目。为项目选择您的 Gradle JVM...在我的例子中是 openjdk-19。现在应该可以了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring Boot 3.x 升级。无法解析 org.springframework.boot:spring-boot-gradle-plugin:3.0.1 的相关文章

随机推荐

  • Python pandas 与 OR 逻辑合并

    我正在搜索 但没有找到这个问题的答案 你可以使用 OR 逻辑执行 pandas 数据帧的合并吗 基本上 相当于使用 where t1 A t2 A OR t1 A t2 B 的 SQL 合并 我遇到一种情况 我将信息从一个数据库提取到数据帧
  • ORACLE SQL LISTAGG 未返回预期结果

    我正在运行 Oracle Database 11g Enterprise 11 2 0 4 0 PL SQL Release 11 2 0 4 0 并且在获取 LISTAGG 函数返回我期望的数据集时遇到一些问题 这是场景 我有一个看起来像
  • 将WAR部署到WebSphere 9需要3个小时

    过去将 WAR 部署到 WebSphere 8 5 5 0 需要 3 分钟 将相同的 WAR 部署到 WebSphere 9 0 0 2 需要 3 个小时 这是 WebSphere 9 0 0 2 中错误的表现吗 有人有类似的经历吗 更新
  • iphone界面发光效果问题

    我想在这个名为 convert 的应用程序中实现我认为是 UILabels 或者可能是自定义控件 的发光效果 我认为该应用程序看起来非常简洁 我正在尝试为我自己的应用程序实现类似的效果 有什么帮助吗 此致 david 替代文本 http w
  • 如何为 Excel 创建 GUI 插件?

    我在 Google 上进行了一些研究 但仍然找不到 Visual Studio 中的项目 我想为 Excel 创建一个 GUI 插件 例如带有 Windows 窗体的功能区上的停靠窗口 这是 Visual Studio 中的什么项目 我已经
  • 将控件添加到 Office 中的现有功能区组 (VSTO)

    我找到了很多关于如何向现有功能区添加新组的示例 这效果很好 我不知道如何将新控件添加到现有功能区上的现有组中 假设我想将自己的命令添加到 审阅 选项卡上的 校对 组中 我正在 VS2010 中为 Office2010 开发此程序 但我想同样
  • Spring Boot中增加Tomcat的连接超时

    如何增加超时 以便在处理响应之前 请求不会超时 Spring Boot 中的 Tomcat 设置 server tomcat max connections 2000 server tomcat max threads 200 server
  • 一个 CIImage 中有多个 CIFilter?

    我有两个 CIFilter 曝光和色调 我需要将过滤器组合到一个 UIImage 上 我该怎么办 下面是我到目前为止所拥有的一些代码 CIFilter hueFilter CIFilter exposureFilter CIImage ad
  • 如何在Python中将数字四舍五入为有效数字

    我需要对要在用户界面中显示的浮动进行舍入 例如 一位有效数字 1234 gt 1000 0 12 gt 0 1 0 012 gt 0 01 0 062 gt 0 06 6253 gt 6000 1999 gt 2000 有没有一种使用 Py
  • Flexbox - 在项目内垂直对齐未知高度的元素[重复]

    这个问题在这里已经有答案了 给予是没有问题的一个元素Flexbox 项目内的高度相同 但我无法让它与多个项目一起使用 Fiddle https jsfiddle net no9jkj7m https jsfiddle net no9jkj7
  • 使用 LayoutInflaterCompat.setFactory 的 Android 菜单项字体

    我正在尝试更改菜单项的字体 根据这个答案 https stackoverflow com a 29903311 2311651 我在用着LayoutInflaterCompat setFactory 我的项目中使用支持库22 1 1 我的代
  • 如何返回完全解决的承诺?

    我正在尝试使用 q 编写一些测试 尝试存根 Promise 等 我想知道是否有一种方法可以返回完全解析的 Promise 就像可以使用whenjs when 要返回的东西 之类的东西来做到这一点那将等于这个 function fullyRe
  • Google 云端硬盘文件 etag

    文件资源的 etag 如何工作 即使文件没有进行任何更改 它看起来也会发生变化 有没有办法获取校验和或仅在文件更新时更改的内容 感谢您的帮助 当文件的元数据更改时 文件的 Etag 也会更改 如果您只想监视文件内容的更改 可以使用md5Ch
  • 我不明白 JavaScript 上的 Crockford:前进之路

    在一场名为 前进之路 的讲座中 道格拉斯 克罗克福德 Douglass Crockford 表示 他不再在 JavaScript 中使用 new 并且正在放弃 this 他说 JavaScript 的优点与其说是原型继承 不如说是无类继承
  • 如何消除单击JavaFX按钮时的展开效果?

    单击 JavaFX 按钮时如何消除小展开效果 还有我怎样才能让它像菜单按钮一样工作 当我按下它以保持聚焦状态直到我按下另一个 菜单 按钮时 有没有办法将节点分组到同一焦点 三个问题一个的价格 单击 JavaFX 按钮时如何消除小展开效果 当
  • 可执行代码处无法到达断点

    我有两个 DLL 一个用本机 C 编写 另一个用 C CLI 编写 前者被注入到进程中 并在稍后的时间点加载后者 在调试时 我注意到本机 DLL 的断点运行正常 而其他断点则运行不正常 即使其代码正在执行 断点显示此消息 不会命中断点 没有
  • 从 C# 的 PowerShell 脚本调用特定函数

    有没有办法从 C 代码的 PowerShell 脚本中调用特定函数 我已经启动并运行了使用 PowerShell 脚本执行字符串的基本示例 如果我有一个包含许多函数的文件 并且我只想将特定函数加载到 C 中并执行它 该怎么办 如何才能做到这
  • FileNotFoundError: [Errno 2] 没有这样的文件或目录: '/content/drive/MyDrive/Santillana/geckodriver' 在 Google Colab 中使用 Selenium 库

    我正在尝试在 Google Colab 中使用 Selenium 但是当我尝试运行 Firefox 实例时出现一些错误 我点击了这个链接 硒文档 https www selenium dev documentation webdriver
  • 新手在 Clojure 中转换 CSV 文件

    我对编程既是新手又是老手 大多数时候我只是在工作中编写很多小的 Perl 脚本 当我想学习 Lisp 时 Clojure 就出现了 所以我也想在不懂 Java 的情况下学习 Clojure 这很艰难 但到目前为止很有趣 我见过几个与我的问题
  • Spring Boot 3.x 升级。无法解析 org.springframework.boot:spring-boot-gradle-plugin:3.0.1

    我最近想将我的 kotlin 项目从 spring boot 2 7 x 升级到 3 0 1 我使用 Java 17 temurin gradle 7 6 在 IntelliJ 中 我在通过 gradle 导入项目时收到以下错误消息 A p