简体   繁体   中英

Java9 module error: Can not determine the module name, the unnamed module reads package and module org.reactivestreams reads package from both

I am getting 3 different errors.

  1. Can not determine the module name ..
  2. the unnamed module reads package..
  3. module org.reactivestreams reads package from both..

what exactly those errors?

build.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'
}

Error Message:

Task :compileJava

error: cannot determine module name for /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

error: the unnamed module reads package io.github.resilience4j.timelimiter.autoconfigure from both resilience4j.spring.boot.common and io.github.resilience4j.springboot2

error: the unnamed module reads package io.github.resilience4j.retry.autoconfigure from both resilience4j.spring.boot.common and io.github.resilience4j.springboot2

error: the unnamed module reads package io.github.resilience4j.ratelimiter.autoconfigure from both resilience4j.spring.boot.common and io.github.resilience4j.springboot2 error: the unnamed module reads package io.github.resilience4j.circuitbreaker.autoconfigure from both resilience4j.spring.boot.common and io.github.resilience4j.springboot2 error: the unnamed module reads package io.github.resilience4j.bulkhead.autoconfigure from both resilience4j.spring.boot.common and io.github.resilience4j.springboot2

error: module org.reactivestreams reads package io.github.resilience4j.timelimiter.autoconfigure from both resilience4j.spring.boot.common and io.github.resilience4j.springboot2

how can we find these two modules from which jar, to exclude those. 1.resilience4j.spring.boot.common, 2. io.github.resilience4j.springboot2. As per my understanding i need to exclude jars from resilience4j-spring-boot2:1.3.1. But i don't understand how to do it?

The packages exported by unnamed module can only be read by another unnamed module. It is not possible that a named module can read (requires) the unnamed module.http://tutorials.jenkov.com/java/modules.html#unnamed-module

You are using Resilience4j as an automatic module, but the rule about not allowing split packages also counts for automatic modules. If multiple JAR files contain (and thus exports) the same Java package, then only one of these JAR files can be used as an automatic module. We have to fix this split package issue in Resilience4j. Until then you can use the -classpath argument to the Java VM when running an application. On the classpath you can include all your older Java classes, just like you have done before Java 9. All classes found on the classpath will be included in what Java calls the unnamed module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM