广告
返回顶部
首页 > 资讯 > 后端开发 > JAVA >Gradle编译失败问题汇总
  • 484
分享到

Gradle编译失败问题汇总

java开发语言 2023-09-21 06:09:36 484人浏览 泡泡鱼
摘要

Gradle编译失败问题汇总 问题1(Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0) A pro

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

--结束END--

本文标题: Gradle编译失败问题汇总

本文链接: https://www.lsjlt.com/news/413654.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作