Open Bing-ok opened 4 years ago
Could you help me review this issue? 👍 Thanks! @jsevellec
i'm seeing something similar in my projects, would love an update on this! thanks!
I have solved this problem for myself by adding io.dropwizard.metrics to the list of shaded (and relocated) dependencies in cassandra-unit-shaded
Issue description
Hi, there are multiple versions of io.dropwizard.metrics:metrics-core in cassandra-unit-master\cassandra-unit. As shown in the following dependency tree, according to Maven's “nearest wins” strategy, only io.dropwizard.metrics:metrics-core:3.1.5 can be loaded, io.dropwizard.metrics:metrics-core:3.1.0 and io.dropwizard.metrics:metrics-core:4.0.5 will be shadowed.
However, several methods defined in shadowed version io.dropwizard.metrics:metrics-core:4.0.5 is referenced by client project via com.datastax.oss:java-driver-core:4.3.1, but missing in the actually loaded version io.dropwizard.metrics:metrics-core:3.1.5.
For instance, the following missing methods(defined in io.dropwizard.metrics:metrics-core:4.0.5) is actually referenced by cassandra-unit-master\cassandra-unit, which will introduce a runtime error(i.e., "NoSuchMethodErrors") into cassandra-unit-master\cassandra-unit.
1. com.codahale.metrics.MetricRegistry: com.codahale.metrics.Gauge gauge(java.lang.String,com.codahale.metrics.MetricRegistry$MetricSupplier) is invoked by cassandra-unit-master\cassandra-unit via the following path:
2. com.codahale.metrics.MetricRegistry: com.codahale.metrics.Timer timer(java.lang.String,com.codahale.metrics.MetricRegistry$MetricSupplier) is invoked by cassandra-unit-master\cassandra-unit via the following path:
Suggested fixing solutions:
Please let me know which solution do you prefer? I can submit a PR to fix it.
Thank you very much for your attention. Best regards,
Dependency tree----