gradle build 发现jdk版本不一致导致

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'demo'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.4.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.4
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.4 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.2' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 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.2')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 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.2')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.4 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.2')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.4 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.2')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 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.2')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 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.2')

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights

在项目中创建 gradle.properties 文件  配置jdk目录  

org.gradle.java.home=/usr/local/java/jdk-17
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
注:下文中的 *** 代表文件名中的版本号。 # 【bcprov-jdk15on-***.jar中文文档.zip】 中包含: 中文文档:【bcprov-jdk15on-***-javadoc-API文档-中文(简体)版.zip】 jar包下载地址:【bcprov-jdk15on-***.jar下载地址(官方地址+国内镜像地址).txt】 Maven依赖:【bcprov-jdk15on-***.jar Maven依赖信息(可用于项目pom.xml).txt】 Gradle依赖:【bcprov-jdk15on-***.jar Gradle依赖信息(可用于项目build.gradle).txt】 源代码下载地址:【bcprov-jdk15on-***-sources.jar下载地址(官方地址+国内镜像地址).txt】 # 本文件关键字: bcprov-jdk15on-***.jar中文文档.zip,java,bcprov-jdk15on-***.jar,org.bouncycastle,bcprov-jdk15on,***,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,bouncycastle,bcprov,jdk15on,中文API文档,手册,开发手册,使用手册,参考手册 # 使用方法: 解压 【bcprov-jdk15on-***.jar中文文档.zip】,再解压其中的 【bcprov-jdk15on-***-javadoc-API文档-中文(简体)版.zip】,双击 【index.html】 文件,即可用浏览器打开、进行查看。 # 特殊说明: ·本文档为人性化翻译,精心制作,请放心使用。 ·只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; ·不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 # 温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件; # Maven依赖: ``` <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk15on</artifactId> <version>***</version> </dependency> ``` # Gradle依赖: ``` Gradle: implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '***' Gradle (Short): implementation 'org.bouncycastle:bcprov-jdk15on:***' Gradle (Kotlin): implementation("org.bouncycastle:bcprov-jdk15on:***") ``` # 含有的 Java package(包)(此处仅列举3个): ``` org.bouncycastle org.bouncycastle.asn1 org.bouncycastle.asn1.anssi ...... ``` # 含有的 Java class(类)(此处仅列举3个): ``` org.bouncycastle.LICENSE org.bouncycastle.asn1.ASN1ApplicationSpecific org.bouncycastle.asn1.ASN1ApplicationSpecificParser ...... ```
注:下文中的 *** 代表文件名中的版本号。 # 【bcprov-jdk15on-***.jar中文文档.zip】 中包含: 中文文档:【bcprov-jdk15on-***-javadoc-API文档-中文(简体)版.zip】 jar包下载地址:【bcprov-jdk15on-***.jar下载地址(官方地址+国内镜像地址).txt】 Maven依赖:【bcprov-jdk15on-***.jar Maven依赖信息(可用于项目pom.xml).txt】 Gradle依赖:【bcprov-jdk15on-***.jar Gradle依赖信息(可用于项目build.gradle).txt】 源代码下载地址:【bcprov-jdk15on-***-sources.jar下载地址(官方地址+国内镜像地址).txt】 # 本文件关键字: bcprov-jdk15on-***.jar中文文档.zip,java,bcprov-jdk15on-***.jar,org.bouncycastle,bcprov-jdk15on,***,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,bouncycastle,bcprov,jdk15on,中文API文档,手册,开发手册,使用手册,参考手册 # 使用方法: 解压 【bcprov-jdk15on-***.jar中文文档.zip】,再解压其中的 【bcprov-jdk15on-***-javadoc-API文档-中文(简体)版.zip】,双击 【index.html】 文件,即可用浏览器打开、进行查看。 # 特殊说明: ·本文档为人性化翻译,精心制作,请放心使用。 ·只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; ·不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 # 温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件; # Maven依赖: ``` <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk15on</artifactId> <version>***</version> </dependency> ``` # Gradle依赖: ``` Gradle: implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '***' Gradle (Short): implementation 'org.bouncycastle:bcprov-jdk15on:***' Gradle (Kotlin): implementation("org.bouncycastle:bcprov-jdk15on:***") ``` # 含有的 Java package(包)(此处仅列举3个): ``` org.bouncycastle org.bouncycastle.asn1 org.bouncycastle.asn1.anssi ...... ``` # 含有的 Java class(类)(此处仅列举3个): ``` org.bouncycastle.LICENSE org.bouncycastle.asn1.ASN1ApplicationSpecific org.bouncycastle.asn1.ASN1ApplicationSpecificParser ...... ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值