Gradle编译失败问题汇总

这篇具有很好参考价值的文章主要介绍了Gradle编译失败问题汇总。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

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。

could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.0.,Java,SpringBoot,java,开发语言

问题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仓库配置。文章来源地址https://www.toymoban.com/news/detail-523409.html

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

到了这里,关于Gradle编译失败问题汇总的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【错误记录】Android Studio 编译报错 ( Could not resolve com.android.tools.build:gradle:7.4.2. )

    在 Mac 中安装了 Android Studio , 首次创建应用运行时 , 报如下错误 : 报错信息中有提示 : Doesn’t say anything about its target Java version (required compatibility with Java 8) A problem occurred configuring root project ‘DataBinding’. Could not resolve all files for configuration ‘:classpath’. Could not resolve com.android.

    2024年02月08日
    浏览(64)
  • Gradle编译失败问题汇总

    原因 Gradle的版本是7.5.1,它绑定的JDK版本是8,但是spring-boot-gradle-plugin:3.0.0要求JDK版本是17以上。所以要把Gradle绑定的JDK版本升级一下。 我用的是IDEA自带的Gradle,所以升级方法是在配置里找到Gradle,把JDK改为17。 这是我配置的maven仓库地址 原因 https://maven.aliyun.com/repository/pu

    2024年02月12日
    浏览(32)
  • Android Studio 解决Could not resolve com.android.tools.build:gradle:7.4.2问题

    A problem occurred configuring root project \\\'MyApplication2\\\'. Could not resolve all files for configuration \\\':classpath\\\'.    Could not resolve com.android.tools.build:gradle:7.4.2.      Required by:          project : com.android.application:com.android.application.gradle.plugin:7.4.2          project : com.android.library:com.android.library.

    2024年02月01日
    浏览(90)
  • 【错误记录】Android 编译报错 ( Could not resolve xxx | 手动下载依赖库并进行本地配置 Gradle 依赖的解决方案 | 构建 Maven 依赖下载路径 )

    编译 Android Studio 项目时 , 报如下错误 , 下载依赖库失败 ; 报错信息 : 下面是 当前 Android 项目的 Gradle 配置中的 Maven 仓库 ; 其中使用 maven { url \\\"https://repo.spring.io/plugins-release/\\\" } 配置的 Maven 仓库就是对应的地址 ; 使用 google() 函数配置的 Maven 仓库地址 是 https://maven.google.com/ , 可

    2024年04月15日
    浏览(78)
  • gradle安装使用遇到的问题:Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

            因为最近新需求搞个系统,要用到这个gradle,然后在mac上搞了好久就一直是出现下面的这个问题。因为我搞好了,出问题的时候忘记截图了,在这里引用一个网友的图(如有侵权请告知)          在最开始我的gradle版本是7.42,然后我的spring-framework是5.3,java的SDK是

    2023年04月08日
    浏览(39)
  • Could not resolve com.android.tools.build:gradle:7.4.2.

    Android Studio 新建工程时报错 Could not resolve com.android.tools.build:gradle:7.4.2. 原因: Android Studio默认的JDK版本与项目配置的Gradle所需的JDK不一致导致冲突所致 解决方法:进入Preferences-Build,Execution,Deployment-Build Tools-Gradle中,将Gradle user home和项目的Gradle JDK改为一样的版本目录

    2024年02月11日
    浏览(48)
  • 解决 Could not resolve com.android.tools.build:gradle:7.4.1

    今天新建了一个工程,报了如下错误 A problem occurred configuring root project \\\'My Application\\\'. Could not resolve all files for configuration \\\':classpath\\\'.    Could not resolve com.android.tools.build:gradle:7.4.1.      Required by:          project : com.android.application:com.android.application.gradle.plugin:7.4.1       

    2024年02月02日
    浏览(44)
  • 解决Build failed:Could not resolve com.android.tools.build:gradle:XXX

    先创建的项目在build时出现下面的报错: 原因:此为Android Studio默认的JDK版本与项目配置的Gradle所需的JDK不一致导致冲突所致。要求选择同一版本的JDK。 解决方案:点击File --Project Structure -SDK Location-JDK location gradle Settings,将Gradle user home和项目的Gradle JDK改为一样的版本目录。

    2024年02月11日
    浏览(52)
  • 报错:Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable

    前言 这段时间想着之前开发的项目不够完善,并且代码写的不够规范,就想着独立规范的开发一个项目,趁此整合学过的技术和丰富自己的项目经验以及规范代码。 正文 错误出现 项目跑起来之后,进行接口测试,发现响应出错  返回控制台,查看日志输出: 项目错误信息

    2024年02月01日
    浏览(51)
  • Android Studio报错:Could not resolve com.android.tools.build:gradle:8.0.0

    Android Studio 新建项目会报以下错误: 完整版报错信息如下: 原因:此为Android Studio默认的JDK版本与项目配置的Gradle所需的JDK不一致导致冲突所致。要求选择同一版本的JDK,可以选择Android Studio自带的jdk17。 解决方案:点击File --Project Structure -SDK Location-JDK location gradle Settings,将

    2024年02月11日
    浏览(57)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包