Dgraph4j dependency problems


(Dx Guan) #1

I use dgrah4j in maven:

<dependency>
  <groupId>io.dgraph</groupId>
  <artifactId>dgraph4j</artifactId>
  <version>1.5.0</version>
</dependency>

However, a error raises while I tried to do a mvn compile and the error messages are mainly like this:

cannot access com.google.protobuf.GeneratedMessageV3
class file for com.google.protobuf.GeneratedMessageV3 not found

Seems like the compiler cannot find this class file GeneratedMessageV3 which should be in this library:

<dependency>
  <groupId>com.google.protobuf</groupId>
  <artifactId>protobuf-java</artifactId>
  <version>3.*.*</version>
</dependency>

After diving into the dependency tree, I found that this library: grpc-protobuf which is depended by dgraph4j has explicitly exclude the library: protobuf-java:

<dependency>
  <groupId>com.google.api.grpc</groupId>
  <artifactId>proto-google-common-protos</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
  <exclusions>
    <exclusion>
      <artifactId>protobuf-java</artifactId>
      <groupId>com.google.protobuf</groupId>
    </exclusion>
    // the other exclusions
    ....
  </exclusions>
</dependency>

Therefore, is it necessary for dgraph4j to explicitly depends on the 3.*.* version of protobuf-java library?

Otherwise, the users(like me) of dgraph4j have to depend on the library above in our project explicitly and seems like a little bit weird.


(Daniel Mai) #2

@deepak Any ideas about this?


(Deepak Jois) #3

@dxGuan

Here is the gradle file from the dgraph4j repository for a sample app: https://github.com/dgraph-io/dgraph4j/blob/master/samples/DgraphJavaSample/build.gradle

The dependency is specified as below:

dependencies {
 	// Use Dgraph Java client
 	compile 'io.dgraph:dgraph4j:1.5.0'

    // Use JUnit test framework
    testCompile 'junit:junit:4.12'
}

This seems to be enough to compile the sample app without any problem. I am trying to figure out how your code may be different from the sample code to reveal this issue. Is it possible to post a minimum working example that demonstrates the problem?

In the meanwhile, I will try by building a sample app that uses maven directly instead of gradle and see if that reproduces the issue.