Skip to content

Datastore: duplicate classes in dependencies #1278

Closed

Description

@janbartel

Using the com.google.cloud:google-cloud-datastore jar version 0.3.0 as a dependency in my project resulted in a lot of transitive dependency jars. I ran the duplicate-finder plugin and it came up with duplicate classes in multiple of the datastore dependenies. Might be something you can do to exclude some of the dependencies?
duplicate-finder.txt

?

Activity

  1. mziccard commented on Sep 23, 2016

    @mziccard
    Contributor

    Hi @janbartel, thanks for your interest in google-cloud-java.

    Duplicated classes related to package com.google.cloud.datastore:datastore-v1-protos:1.0.1 were already discussed here and we should be able to resolve them soon.

    For what concerns guava-related classes it seems that our dependency com.google.cloud.datastore:datastore-v1-proto-client is pulling guava-jdk5, which should be excluded instead (we do that elsewhere). @eddavisson would you consider excluding guava-jdk5? I believe google-http-client-protobuf is pulling it. The following updated dependency declaration should do the trick:

    <dependency>
      <groupId>com.google.http-client</groupId>
        <artifactId>google-http-client-protobuf</artifactId>
        <version>1.20.0</version>
        <exclusions>
          <exclusion>
            <artifactId>guava-jdk5</artifactId>
            <groupId>com.google.guava</groupId>
          </exclusion>
        </exclusions>
    </dependency>

    Also @eddavisson, I noticed that you still duplicate some common proto-related classes in datastore-v1-protos:1.2.0:

    [WARNING]   com.google.api.AnnotationsProto
    [WARNING]   com.google.api.CustomHttpPattern
    [WARNING]   com.google.api.CustomHttpPatternOrBuilder
    [WARNING]   com.google.api.Http
    [WARNING]   com.google.api.HttpOrBuilder
    [WARNING]   com.google.api.HttpProto
    [WARNING]   com.google.api.HttpRule
    [WARNING]   com.google.api.HttpRuleOrBuilder
    [WARNING]   com.google.rpc.Code
    [WARNING]   com.google.rpc.CodeProto
    [WARNING]   com.google.rpc.Status
    [WARNING]   com.google.rpc.StatusOrBuilder
    [WARNING]   com.google.rpc.StatusProto
    [WARNING]   com.google.type.LatLng
    [WARNING]   com.google.type.LatLngOrBuilder
    [WARNING]   com.google.type.LatLngProto

    You should be able to pull those dependencies from com.google.api.grpc:grpc-google-common-protos:0.1.0.

  2. eddavisson commented on Sep 23, 2016

    @eddavisson

    Some of the code in google-http-client-protobuf has an actual dependency on guava (though not in a public interface). Would the exclusion break that (or should we shade it instead)? I'm still a bit of a novice when it comes to Maven.

    That's great to know that the common proto classes are now available in a Maven artifact. I will work on making that update.

  3. mziccard commented on Sep 23, 2016

    @mziccard
    Contributor

    From the dependency tree I see:

    [INFO] +- com.google.cloud.datastore:datastore-v1-proto-client:jar:1.1.0:compile
    [INFO] |  +- com.google.http-client:google-http-client-protobuf:jar:1.20.0:compile
    [INFO] |  \- com.google.api-client:google-api-client:jar:1.20.0:compile
    [INFO] |     \- com.google.guava:guava-jdk5:jar:13.0:compile

    guava-jdk5 is pulled by com.google.api-client:google-api-client. Something similar happens also in google-cloud-core where we already include a more recent version of guava (as you also do in datastore-v1-proto-client) and went ahead to exclude guava-jdk5. But don't trust my words, you better give it a try :)

  4. mziccard commented on Sep 29, 2016

    @mziccard
    Contributor

    @janbartel we just released google-cloud 0.4.0 which should have considerably removed duplicate classes. We still have some duplicates related to the following dependencies of ours:

    • datastore-v1-proto-client and grpc-google-common-protos: @eddavisson is taking care of this
    • protobuf-java and protobuf-lite: I need to investigate wether is safe to exclude protobuf-lite
  5. eddavisson commented on Oct 5, 2016

    @eddavisson

    datastore-v1-protos:1.3.0 removes the classes mentioned above and datastore-v1-proto-client:1.3.0 excludes guava-jdk5.

  6. mziccard commented on Oct 5, 2016

    @mziccard
    Contributor

    Thank you @eddavisson, I will take care of updating the dependency soon!

  7. 8 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions