Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

shaded consul-client shouldn't include Guava transitive dependencies #266

Open
pkwarren opened this issue Oct 26, 2017 · 3 comments
Open

Comments

@pkwarren
Copy link

Since updating to a newer version of Guava, the shaded client has started shipping Guava transitive dependencies (without relocating them):

 +- com.google.guava:guava:jar:22.0:compile
 |  +- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
 |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
 |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile

Since guava is excluded from shading (https://github.com/OrbitzWorldwide/consul-client/blob/aa41cbd47d1653c2d6a2533cf93c58c89ba80375/pom.xml#L258), it would be helpful if these weren't shaded either to avoid class conflicts at runtime.

As part of analyzing this, I also found the jsr305 artifact is shaded (and not relocated). In order to resolve these, I propose the following fix:

diff --git a/pom.xml b/pom.xml
index 339b1ae..cc3d426 100644
--- a/pom.xml
+++ b/pom.xml
@@ -256,6 +256,11 @@
                                     <exclude>org.slf4j:slf4j-api</exclude>
                                     <exclude>org.immutables:values</exclude>
                                     <exclude>com.google.guava:guava</exclude>
+                                    <exclude>com.google.code.findbugs:jsr305</exclude>
+                                    <!-- Pulled in as transitive dependencies from Guava -->
+                                    <exclude>com.google.errorprone:error_prone_annotations</exclude>
+                                    <exclude>com.google.j2objc:j2objc-annotations</exclude>
+                                    <exclude>org.codehaus.mojo:animal-sniffer-annotations</exclude>
                                 </excludes>
                             </artifactSet>
                             <relocations>
@adericbourg
Copy link
Collaborator

Guava is back in the shaded Jar (see 2995997), so I guess this issue is obsolete?

Do you agree @pkwarren?

@pkwarren
Copy link
Author

pkwarren commented Dec 6, 2017

This is fixed, however I noticed that both jsr305 and animal-sniffer-annotations are both packaged in the shaded jar now (without relocation).

Screenshot

@adericbourg
Copy link
Collaborator

Indeed. I tried to relocate javax.annotation from jsr305 only but I cannot find a way to do that with the Maven Shade plugin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants