You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Henrik Hegardt (Jira)" <ji...@apache.org> on 2019/10/09 19:56:00 UTC

[jira] [Comment Edited] (RATIS-699) Dependency is relying on system dependency jdk:tools:1.X

    [ https://issues.apache.org/jira/browse/RATIS-699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16947952#comment-16947952 ] 

Henrik Hegardt edited comment on RATIS-699 at 10/9/19 7:55 PM:
---------------------------------------------------------------

Best practice with Maven is to declare the code's direct dependencies in the pom, and the code does have direct dependency on hadoop-common through the org.apache.hadoop.metrics2.lib.DefaultMetricsSystem class which is part of the hadoop-common dependency. It also seems like it's a central piece of the generic metrics functionality of ratis-metrics.

The jdk.tools dependency isn't used by the Ratis code, just an unfortunate dependency which hadoop-common both version 2.6.0 and .3.1.2  have a dependency on. Though in the 3.1.2 it resolves properly, by not being activated by using profiles when used with java 11. To define jdk.tools in the pom wouldn't override the transitive dependency which the 2.6.0 uses, because it still has to be managed through profiles and turned off, when it's needed, otherwise it would fail java 11 builds, since the tools.jar doesn't exist in Java 11+.  I think one could try and shadow it with declaring the coordinates for jdk.tools:1.6 in the ratis-metrics pom but then would leave us with an empty dependency which I think would be ugly. System dependencies are also deprecated in maven and planned to be removed.

Also since we are already running with the 2.6.0 hadoop-common jar with all it's transitive dependencies, which are by now quite old, would possible pollute a project's classpath for an unsuspecting user.  Updating it to 3.1.2 would at least align the code and tests with running 3.1.2 and throughout the project.

The best solution would be to remove the dependency on the org.apache.hadoop.metrics2.lib.DefaultMetricsSystem and friends classes because then it would remove the hadoop-common dependency. Though that's a little bigger job than just solving the jdk.tools problem. Though I think [~elek] did it in [https://github.com/apache/incubator-ratis/pull/39] to fix RATIS-702. Then we wouldn't need this patch at all.

 

 


was (Author: hheg):
Best practice with Maven is to declare the code's direct dependencies in the pom, and the code does have direct dependency on hadoop-common through the org.apache.hadoop.metrics2.lib.DefaultMetricsSystem class which is part of the hadoop-common dependency. It also seems like it's a central piece of the generic metrics functionality of ratis-metrics.

The jdk.tools dependency isn't used by the Ratis code, just an unfortunate dependency which hadoop-common both version 2.6.0 and .3.1.2  have a dependency on. Though in the 3.1.2 it resolves properly, by not being activated by using profiles when used with java 11. To define jdk.tools in the pom wouldn't override the transitive dependency which the 2.6.0 uses, because it still has to be managed through profiles and turned off, when it's needed, otherwise it would fail java 11 builds again since the tools.jar doesn't exist in Java 11+.  I think one could try and shadow it with declaring the coordinates for jdk.tools:1.6 in the ratis-metrics pom but then would leave us with an empty dependency which I think would be ugly. System dependencies are also deprecated in maven and planned to be removed.

Also since we are already running with the 2.6.0 hadoop-common jar with all it's transitive dependencies, which are by now quite old, would possible pollute a project's classpath for an unsuspecting user.  Updating it to 3.1.2 would at least align the code and tests with running 3.1.2 and throughout the project.

The best solution would be to remove the dependency on the org.apache.hadoop.metrics2.lib.DefaultMetricsSystem and friends classes because then it would remove the hadoop-common dependency. Though that's a little bigger job than just solving the jdk.tools problem. Though I think [~elek] did it in [https://github.com/apache/incubator-ratis/pull/39] to fix RATIS-702. Then we wouldn't need this patch at all.

 

 

> 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.03.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)