文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

Gradle编译失败问题汇总

2023-09-21 06:32

关注

Gradle编译失败问题汇总

问题1(Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0)

A problem occurred configuring root project 'clickIn'.> Could not resolve all files for configuration ':classpath'.   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.     Required by:         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.0      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.0 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5.1' but:          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.0 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 8              - Other compatible attribute:                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.0 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 8)                  - 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.5.1')          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.0 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 8              - Other compatible attribute:                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.0 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 8              - Other compatible attribute:                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.0 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 8              - Other compatible attribute:                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.0 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 8)                  - 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.5.1')

原因
Gradle的版本是7.5.1,它绑定的JDK版本是8,但是spring-boot-gradle-plugin:3.0.0要求JDK版本是17以上。所以要把Gradle绑定的JDK版本升级一下。
我用的是IDEA自带的Gradle,所以升级方法是在配置里找到Gradle,把JDK改为17。

问题2(Failed to resolve imported Maven)

org.gradle.api.GradleException: Failed to resolve imported Maven boms: Could not find org.springframework.cloud:spring-cloud-dependencies:2022.0.0-RC2.Searched in the following locations:  - https://maven.aliyun.com/repository/public/org/springframework/cloud/spring-cloud-dependencies/2022.0.0-RC2/spring-cloud-dependencies-2022.0.0-RC2.pom

这是我配置的maven仓库地址

repositories {    maven {        url 'https://maven.aliyun.com/repository/public/'    }    mavenLocal()    mavenCentral()}

原因
https://maven.aliyun.com/repository/public/仓库下找不到spring-cloud-dependencies:2022.0.0-RC2这个bom。去阿里云的maven后台【跳转】参考搜索一下版本所在的仓库,发现是在grails-core仓库下面,所以再添加https://maven.aliyun.com/repository/grails-core仓库配置。

repositories {    maven {        url 'https://maven.aliyun.com/repository/public/'    }    // 新增    maven {        url 'https://maven.aliyun.com/repository/grails-core'    }    mavenLocal()    mavenCentral()}

来源地址:https://blog.csdn.net/u010363836/article/details/128351899

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯