1

我收到 3 个不同的错误。

  1. 无法确定模块名称..
  2. 未命名的模块读取包..
  3. 模块 org.reactivestreams 从两者中读取包..

这些错误到底是什么?

构建.gradle

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-webflux'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
     exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
     exclude group: 'org.mockito', module: 'mockito-core'
    }
 
    testImplementation 'io.projectreactor:reactor-test'
    testImplementation 'org.springframework.restdocs:spring-restdocs-webtestclient'
   

    compile("io.github.resilience4j:resilience4j-spring-boot2:1.3.1") {
     exclude group: 'org.mockito', module: 'mockito-core'
     }
   compile("io.github.resilience4j:resilience4j-reactor:1.3.1") {
     exclude group: 'org.mockito', module: 'mockito-core'
   }
   compile('org.springframework.boot:spring-boot-starter-aop')
   compile('org.springframework.boot:spring-boot-starter-actuator')
   compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
}

错误信息:

任务:编译Java

错误:无法确定 /Users/srihariprasad/.gradle/caches/modules-2/files-2.1/io.github.resilience4j/resilience4j-framework-common/1.3.1/8c16dda86fad3c9251930cad21ac87aa34cd8035/resilience4j-framework-common-1.3 的模块名称.1.jar

错误:未命名的模块从弹性4j.spring.boot.common 和io.github.resilience4j.springboot2 读取包io.github.resilience4j.timelimiter.autoconfigure

错误:未命名的模块从弹性4j.spring.boot.common 和io.github.resilience4j.springboot2 读取包io.github.resilience4j.retry.autoconfigure

错误:未命名的模块从弹性4j.spring.boot.common 和io.github.resilience4j.springboot2 读取包io.github.resilience4j.ratelimiter.autoconfigure 错误:未命名的模块读取包io.github.resilience4j.circuitbreaker.autoconfigure 从弹性4j.spring.boot.common 和io.github.resilience4j.springboot2 错误:未命名的模块从resilience4j.spring.boot.common 和io.github.resilience4j.springboot2 读取包io.github.resilience4j.bulkhead.autoconfigure

错误:模块 org.reactivestreams 从弹性4j.spring.boot.common 和 io.github.resilience4j.springboot2 读取包 io.github.resilience4j.timelimiter.autoconfigure

我们如何才能从哪个jar中找到这两个模块,排除那些。1.resilience4j.spring.boot.common,2.io.github.resilience4j.springboot2。据我了解,我需要从弹性4j-spring-boot2:1.3.1 中排除罐子。但我不明白该怎么做?

4

1 回答 1

2

未命名模块导出的包只能被另一个未命名模块读取。命名模块不可能读取(需要)未命名模块。 http://tutorials.jenkov.com/java/modules.html#unnamed-module

您将 Resilience4j 用作自动模块,但不允许拆分包的规则也适用于自动模块。如果多个 JAR 文件包含(并因此导出)同一个 Java 包,那么这些 JAR 文件中只有一个可以用作自动模块。我们必须在 Resilience4j 中修复这个拆分包问题。在此之前,您可以在运行应用程序时使用 Java VM 的 -classpath 参数。在类路径中,您可以包含所有较旧的 Java 类,就像您在 Java 9 之前所做的那样。在类路径中找到的所有类都将包含在 Java 所称的未命名模块中。

于 2020-02-26T08:54:44.107 回答