当前位置: 首页 > 知识库问答 >
问题:

不兼容,因为该组件声明了一个与Java11兼容的组件,并且消费者需要一个与Java10兼容的组件

南宫阳冰
2023-03-14

在我的身材中。gradle file I升级了一个依赖项的版本(即:com.db:microservice commons)。加载gradle更改后,我收到以下错误消息

> Build file 'C:\Projects\Container\mschmidt\mount\booking-service\standalone\build.gradle' line: 50

   > A problem occurred evaluating project ':standalone'.
   > Could not resolve all files for configuration ':standalone:runtimeClasspath'.
   > Could not resolve com.db:microservice-commons:2.4.1.
     Required by:
         project :standalone
         project :standalone > project :service
      > No matching variant of com.db:microservice-commons:2.4.1 was found. The consumer was configured to find a runtime of a library compatible with Java 10, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - Variant 'apiElements' capability com.db:microservice-commons:2.4.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 11 and the consumer needed a runtime of a component compatible with Java 10
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'runtimeElements' capability com.db:microservice-commons:2.4.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 11 and the consumer needed a component compatible with Java 10
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'samplessources' capability com.db:microservice-commons:2.4.1:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 10)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about its usage (required a runtime)

文件“C:\Projects\Container\mschmidt\mount\booking service\standalone\build”的第50行。gradle的外观如下:

 manifest {
    def manifestClasspath = configurations.runtimeClasspath.collect { it.getName() }.join(' ')
    attributes 'Archiver-Version': 'Plexus Archiver'
    attributes 'Build-Jdk': org.gradle.internal.jvm.Jvm.current()
    attributes 'Main-Class': 'com.db.service.standalone.Standalone', 'Class-Path': manifestClasspath
    }
}
 

我不知道该怎么办。JDK项目和Gradle JVM设置为Java 11。本文:消费者被配置为查找与Java 11兼容的库的运行时,打包为jar,其依赖项在外部声明,但。。。属于同一个问题,但没有帮助我。

知道这是怎么回事吗?

共有1个答案

边霄
2023-03-14

好的,我发现了问题。

build.gradle文件中有以下两行:

 sourceCompatibility = 10
 targetCompatibility = 10

他们需要改成11个。然后就成功了。

 类似资料:
  • 我维护了一个内部库,并将构建和发布它的JDK从11升级到17。我还同时从Gradle 6.8.1升级到7.4.2。 当尝试在一些现有项目中使用新版本的库时,我得到了这个错误: 这是不言而喻的,但我不明白,因为在我的库中,我在gradle中定义了它。生成文件: 所以我希望我构建的jar与JDK 11兼容。。但很明显,事实并非如此。 我错过了什么?

  • 我刚刚在PHP 5.4上安装了woocommerce 2.0(在Wordpress上),我得到了这个: 严格标准:WC_Gateway_BACS::process_payment()的声明应与D:\my\path\to\htdocs\wordpress\plugins\woocommerce\classs\Gateway\BACS\class WC-Gateway-BACS中的WC_payment

  • 当我想安装设备驱动程序时,我的MacOs版本Big Sur出现了问题。准确地说,是一款天才的鼠标笔i608X。我的操作系统说: 此软件包不兼容。该软件包正在尝试将内容安装到系统卷。请联系软件制造商以获得帮助。块引用 制造商没有开发新的驱动程序,所以我需要安装这个版本。 你能告诉我如何解决这个问题吗?

  • 问题内容: 我正在使用来自AJAX发布请求的回调来导航到新页面,但是在Internet Explorer上不起作用。我的代码如下: 这在FF / Safari / Chrome上正常运行,但是当我在IE上对其进行测试时,它不起作用。是否有更好的方法重定向到新页面?我正在使用,因为如果我不使用回调,则数据不会加载到Chrome / Safari上,因为在请求完成之前页面只会更改。 问题答案: 是括号

  • 我有一个关于JavaAPI中Akka 2.0.1的问题。我有以下情况: 参与者A:从UI接收请求。然后它将执行以下操作。 等待来自UI的消息 发送msg到Actor B,以检索数据 成为一个演员,当从演员B那里得到答案时,处理它。 演员B: 等待演员A的消息 检索数据 调用; 这不起作用,演员甲也不会得到答案。然而,如果Actor B在系统中使用全局actorRef到Actor A,在我的情况下z

  • 现在我看到了Intellij Idea更新窗口中的概念: 发现与新版本不兼容的插件:Lombok插件 有没有办法解决这个问题,或者我应该等到龙目岛插件团队解决了兼容性问题?