2017-06-09 58 views
7

Próbuję użyć rozruchu wiosennego z Java 9 i gradle. jestem w stanie uruchomić mój prosty kod, pojawia się niżej wymieniony błąd: -Moduł java 9 czyta pakiet X z A i B

Information:java: Errors occurred while compiling module 'Java9Gradle_main' 
Information:javac 9-ea was used to compile java sources 
Information:6/9/2017 10:40 PM - Compilation completed with 65 errors and 0 warnings in 15s 200ms 
Error:java: module reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.starter.web reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.starter.web reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.autoconfigure reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.autoconfigure reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.starter.logging reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.starter.logging reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.core reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.core reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module snakeyaml reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module snakeyaml reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.starter.tomcat reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.starter.tomcat reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module hibernate.validator reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module hibernate.validator reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module jackson.databind reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module jackson.databind reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.web reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.web reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.webmvc reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.webmvc reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.context reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.context reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module logback.classic reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module logback.classic reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module jcl.over.slf4j reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module jcl.over.slf4j reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module jul.to.slf4j reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module jul.to.slf4j reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module log4j.over.slf4j reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module log4j.over.slf4j reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module commons.logging reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module commons.logging reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module tomcat.embed.core reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module tomcat.embed.core reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module tomcat.embed.el reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module tomcat.embed.el reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module tomcat.embed.websocket reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module tomcat.embed.websocket reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module validation.api reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module validation.api reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module jboss.logging reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module jboss.logging reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module classmate reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module classmate reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module jackson.annotations reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module jackson.annotations reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module jackson.core reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module jackson.core reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.aop reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.aop reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.beans reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.beans reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.expression reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.expression reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module logback.core reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module logback.core reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module slf4j.api reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module slf4j.api reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.starter reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot.starter reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 
Error:java: module spring.boot reads package org.apache.commons.logging.impl from both jcl.over.slf4j and commons.logging 
D:\project\Java9Gradle\src\main\java\module-info.java 
Error:(1, 1) java: module Java9Gradle.main reads package org.apache.commons.logging from both jcl.over.slf4j and commons.logging 

Mój plik Zależności a plik module-info.java są bardzo proste.

module Java9Gradle.main { 
    requires spring.boot; 
} 


group 'Java9Gradle' 
version '1.0-SNAPSHOT' 

apply plugin: 'java' 

sourceCompatibility = 1.9 

repositories { 
    mavenCentral() 
} 

dependencies { 
    // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter 
    compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: '1.5.3.RELEASE' 
    // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web 
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.3.RELEASE' 
    testCompile group: 'junit', name: 'junit', version: '4.12' 
} 

Czy ktoś może pomóc?

Dzięki,

Amar

Odpowiedz

4

Wyłączając zależność przechodnia wykonana pracować i dostosowanie module-info.java zbyt !!!

compile("org.springframework.boot:spring-boot-starter:1.5.3.RELEASE") { 
     exclude group: 'commons-logging', module: 'commons-logging' 
    } 
    compile("org.springframework.boot:spring-boot-starter-web:1.5.3.RELEASE"){ 
     exclude group: 'commons-logging', module: 'commons-logging' 
    } 
+1

Jakie korekty były wymagane w pliku module-info.java? – JMess

4

Według nieingerencji Jigsaw specs

- kompilator Javy, maszyny wirtualne i Run-Time System musi zapewnić, że moduły zawierające pakiety o tej samej nazwie nie zakłócają wzajemnie. Jeśli dwa odrębne moduły zawierają pakiety o tej samej nazwie, to z perspektywy każdego modułu, wszystkie typy i elementy tego pakietu są zdefiniowane tylko przez ten moduł . Kod w tym pakiecie w jednym module nie może mieć dostępu do pakietów prywatnych typów ani członków w tym pakiecie w drugim module.

ten jest określany jako pakietach podzielonych odpowiedź przez @Andy here. Rozwiązaniem jest rozpakowanie tych pakietów i upewnienie się, że pakiety zawarte w modułach jcl.over.slf4j i commons.logging są dostępne za pośrednictwem tylko jednego modułu.


Można analizować zarówno zależności spring-boot-starter:1.5.3.RELEASE i spring-boot-starter-web:1.5.3.RELEASE aby upewnić się jeden z dwóch modułów jest zawarty w projekcie.