Weijie Sun created TINKERPOP-3014: ------------------------------------- Summary: Dependencny jcl-over-slf4j in gremlin-core is declared but unused due to dependency conflict. Key: TINKERPOP-3014 URL: https://issues.apache.org/jira/browse/TINKERPOP-3014 Project: TinkerPop Issue Type: Bug Reporter: Weijie Sun
h2. Problem Description "gremlin-core" declares "jcl-over-slf4j" as its dependency. However, it seems that the dependency is actually unused due to a dependency conflict. There is another dependency "commons-logging:commons-logging" in the dependency tree as listed below: {code:java} org.apache.tinkerpop:gremlin-core:jar:3.7.0-SNAPSHOT \- org.apache.commons:commons-configuration2:jar:2.9.0:compile \- commons-logging:commons-logging:jar:1.2:compile \- org.slf4j:jcl-over-slf4j:jar:1.7.33:compile{code} The classes in "jcl-over-slf4j" are also in "commons-logging" as listed below: {code:java} [INFO] org.apache.commons.logging.impl.NoOpLog [INFO] org.apache.commons.logging.impl.SimpleLog$1 [INFO] org.apache.commons.logging.impl.SimpleLog [INFO] org.apache.commons.logging.impl.SLF4JLocationAwareLog [INFO] org.apache.commons.logging.impl.SLF4JLog [INFO] org.apache.commons.logging.impl.SLF4JLogFactory [INFO] org.apache.commons.logging.Log [INFO] org.apache.commons.logging.LogConfigurationException [INFO] org.apache.commons.logging.LogFactory{code} The problem is that "commons-logging" is ahead of "jcl-over-slf4j" in the dependency tree, thus ahead of "jcl-over-slf4j" in the classpath. When multiple JAR files contain the same class, the class loader will load the first occurrence it finds based on the classpath order. This means the classloader will select classes in "commons-logging" instead of "jcl-over-slf4j". So despite "jcl-over-slf4j" being declared directly, it's actually unused. "commons-logging" is the actual used dependency, causing confusion. h2. Possible Solution Change the order of "jcl-over-slf4j" and "commons-logging" so that "jcl-over-slf4j" appears ahead of "commons-logging" in the classpath. In this way, "jcl-over-slf4j" is used as intended. -- This message was sent by Atlassian Jira (v8.20.10#820010)