I am trying to use spring boot with java 9 and gradle. I am unable to run my simple code, I get the below mentioned error :-
Information:java: Errors occurre
Excluding the transitive dependency made it work and adjusting the module-info.java too!!!
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'
}
According to the Jigsaw specs
Non-interference — The Java compiler, virtual machine, and run-time system must ensure that modules that contain packages of the same name do not interfere with each other. If two distinct modules contain packages of the same name then, from the perspective of each module, all of the types and members in that package are defined only by that module. Code in that package in one module must not be able to access package-private types or members in that package in the other module.
This is referred to as split packages in the answer by @Andy here. The solution thereby is to unsplit these packages and make sure that the packages that are included from your modules jcl.over.slf4j
and commons.logging
are accessed via only one module.
You can analyze both dependencies spring-boot-starter:1.5.3.RELEASE
and spring-boot-starter-web:1.5.3.RELEASE
to make sure either of the two modules is included in your project.