I've problem replace commons-logging with jcl-over-slf4j in Java 9 Module System. I've exclude commons-logging from maven and add jcl-over-slf4j as dependency:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.3</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.8.0-beta2</version>
</dependency>
As I can see, the commons-configuration2 is an auto named module and the jcl-over-slf4j is an application module.
If I leave the module jcl-over-slf4j out of module-info.java, I got this NoClassDefFoundError error, the jcl-over-slf4j is on the classpath somehow the library can't see it:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/Log
at org.apache.commons.configuration2@2.3/org.apache.commons.configuration2.io.FileSystem.<clinit>(FileSystem.java:37)
If I add the jcl-over-slf4j to the module-info.java, I got this illegal access error,:
requires transitive org.apache.commons.logging;
Which org.apache.commons.logging module is in fact the jcl-over-slf4j module.
xception in thread "main" java.lang.IllegalAccessError: class org.apache.commons.configuration2.io.ConfigurationLogger (in module org.apache.commons.configuration2) cannot access class org.apache.commons.logging.impl.NoOpLog (in module org.apache.commons.logging) because module org.apache.commons.logging does not export org.apache.commons.logging.impl to module org.apache.commons.configuration2
at org.apache.commons.configuration2@2.3/org.apache.commons.configuration2.io.ConfigurationLogger.newDummyLogger(ConfigurationLogger.java:115)
Which I don't understand, the commons-configuration2 shoulde be able to access it, and I'm stuck here. Any help is welcome.