[
https://issues.apache.org/jira/browse/RATIS-699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16946550#comment-16946550
]
Henrik Hegardt commented on RATIS-699:
--------------------------------------
[~szetszwo] The thing is that Ratis-Metric is already including the hadoop
dependency transitivley because the dependency
com.github.joshelser:dropwizard-metrics-hadoop-metrics2-reporter: 0.1.2 has a
dependency on hadoop-common version 2.6.0. Which is causing this bug.
A printout of Ratis-Metrics dependency tree
{code:java}
[INFO] -------------------< org.apache.ratis:ratis-metrics >-------------------
[INFO] Building Apache Ratis Metrics 0.5.0-SNAPSHOT [5/15]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ratis-metrics ---
[INFO] org.apache.ratis:ratis-metrics:jar:0.5.0-SNAPSHOT
[INFO] +- org.apache.ratis:ratis-proto:jar:0.5.0-SNAPSHOT:compile
[INFO] | \- org.apache.ratis:ratis-thirdparty-misc:jar:0.2.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.10:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.mockito:mockito-all:jar:1.8.5:test
[INFO] +- org.apache.ratis:ratis-common:jar:0.5.0-SNAPSHOT:compile
[INFO] | \- org.slf4j:slf4j-log4j12:jar:1.7.10:compile
[INFO] | \- log4j:log4j:jar:1.2.17:compile
[INFO] +- io.dropwizard.metrics:metrics-core:jar:3.2.5:compile
[INFO] +- org.apache.ratis:ratis-common:test-jar:tests:0.5.0-SNAPSHOT:test
[INFO] +-
com.github.joshelser:dropwizard-metrics-hadoop-metrics2-reporter:jar:0.1.2:compile
[INFO] | \- org.apache.hadoop:hadoop-common:jar:2.6.0:compile
[INFO] | +- org.apache.hadoop:hadoop-annotations:jar:2.6.0:compile
[INFO] | | \- jdk.tools:jdk.tools:jar:1.6:system
[INFO] | +- com.google.guava:guava:jar:11.0.2:compile
[INFO] | +- commons-cli:commons-cli:jar:1.2:compile
[INFO] | +- org.apache.commons:commons-math3:jar:3.1.1:compile
[INFO] | +- xmlenc:xmlenc:jar:0.52:compile
[INFO] | +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | +- commons-codec:commons-codec:jar:1.4:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | +- commons-net:commons-net:jar:3.1:compile
[INFO] | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] | +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] | +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] | +- com.sun.jersey:jersey-core:jar:1.9:compile
[INFO] | +- com.sun.jersey:jersey-json:jar:1.9:compile
[INFO] | | +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] | | +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] | | | \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] | | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | | \- javax.activation:activation:jar:1.1:compile
[INFO] | | +- org.codehaus.jackson:jackson-jaxrs:jar:1.8.3:compile
[INFO] | | \- org.codehaus.jackson:jackson-xc:jar:1.8.3:compile
[INFO] | +- com.sun.jersey:jersey-server:jar:1.9:compile
[INFO] | | \- asm:asm:jar:3.1:compile
[INFO] | +- tomcat:jasper-compiler:jar:5.5.23:runtime
[INFO] | +- tomcat:jasper-runtime:jar:5.5.23:runtime
[INFO] | +- javax.servlet.jsp:jsp-api:jar:2.1:runtime
[INFO] | +- commons-el:commons-el:jar:1.0:runtime
[INFO] | +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | +- net.java.dev.jets3t:jets3t:jar:0.9.0:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.1.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.1.2:compile
[INFO] | | \- com.jamesmurty.utils:java-xmlbuilder:jar:0.4:compile
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] | | +- commons-digester:commons-digester:jar:1.8:compile
[INFO] | | | \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] | | \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | +- org.apache.avro:avro:jar:1.7.4:compile
[INFO] | | +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] | | \- org.xerial.snappy:snappy-java:jar:1.0.4.1:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:2.5.0:compile
[INFO] | +- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] | +- org.apache.hadoop:hadoop-auth:jar:2.6.0:compile
[INFO] | | +-
org.apache.directory.server:apacheds-kerberos-codec:jar:2.0.0-M15:compile
[INFO] | | | +-
org.apache.directory.server:apacheds-i18n:jar:2.0.0-M15:compile
[INFO] | | | +-
org.apache.directory.api:api-asn1-api:jar:1.0.0-M20:compile
[INFO] | | | \- org.apache.directory.api:api-util:jar:1.0.0-M20:compile
[INFO] | | \- org.apache.curator:curator-framework:jar:2.6.0:compile
[INFO] | +- com.jcraft:jsch:jar:0.1.42:compile
[INFO] | +- org.apache.curator:curator-client:jar:2.6.0:compile
[INFO] | +- org.apache.curator:curator-recipes:jar:2.6.0:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- org.htrace:htrace-core:jar:3.0.4:compile
[INFO] | +- org.apache.zookeeper:zookeeper:jar:3.4.6:compile
[INFO] | | \- io.netty:netty:jar:3.7.0.Final:compile
[INFO] | \- org.apache.commons:commons-compress:jar:1.4.1:compile
[INFO] | \- org.tukaani:xz:jar:1.0:compile
[INFO] +- io.dropwizard.metrics:metrics-jvm:jar:3.2.5:compile
[INFO] \- io.dropwizard.metrics:metrics-ganglia:jar:3.2.5:compile
[INFO] \- info.ganglia.gmetric4j:gmetric4j:jar:1.0.7:compile
{code}
And since the Ratis-Hadoop module specify the 3.1.1 version it should be the
same version in all projects which is why I included it directly in the
project. The code also does have a direct dependency on the hadoop-common
dependency, via the org.apache.hadoop.metrics2.lib.DefaultMetricsSystem class
in the org.apache.ratis.metrics.MetricsReporting class, so there must be a
dependency on hadoop-common otherwise it won't compile, nor run.
Problem is that Maven doesn't allow for you to specify a parameter to override
a transitive dependency. So we have to include it as a explicit dependency to
override those transitive dependencies.
However I now noticed that I should have used the property instead of setting
the version hard in the pom. I will change that.
I think that we should try and get rid of the transitive dependency on hadoop
from ratis-metrics, which I think should be considered in RATIS-702. But to
move forward, this patch should be included for now to solve the jdk.tools and
hadoop-common version inconsistency.
> Dependency is relying on system dependency jdk:tools:1.X
> --------------------------------------------------------
>
> Key: RATIS-699
> URL: https://issues.apache.org/jira/browse/RATIS-699
> Project: Ratis
> Issue Type: Bug
> Components: metrics
> Affects Versions: 0.4.0
> Reporter: Henrik Hegardt
> Assignee: Henrik Hegardt
> Priority: Minor
> Attachments: RATIS-699.01.patch, RATIS-699.02.patch, RATIS-699.patch,
> tree_new, tree_orig
>
>
> Ratis-Metric is depending on the dependency
> com.github.joshelser:dropwizard-metrics-hadoop-metrics2-reporter: 0.1.2. This
> in turn depends on the org.apache.hadoop:hadoop-common:2.6.0. This in turn
> depends on org.apache.hadoop:hadoop-annotations:2.6.0 which have an
> dependency on a system scoped dependency named jdk.tools:1.6. I'm running
> java 11 and this dependency doesn't exist in my environment so I can't
> compile with ratis included in my project because it fails trying to resolve
> that dependency.
> However, the project ratis-hadoop depends on the the dependency
> org.apache.hadoop:hadoop-common:3.1.1 (which should be upgraded to 3.1.2
> because the sources are missing in 3.1.1) which doesn't have the
> jdk.tools:1.6 dependency. So if I depend on this I can build the project
> because the faulty 2.6.0 dependency is shadowed transitively by the 3.1.1
> dependency and everything is compiling.
> The simple fix would be updating so ratis-metric is depending directly on the
> 3.1.2 dependency instead since it effectively will be the 3.1.1 code you are
> going run with anyway when running with the ratis-hadoop dependency.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)