gRPC and Java Proto3

331 views
Skip to first unread message

Nicolas Vacelet

unread,
Jun 27, 2016, 5:11:39 PM6/27/16
to Protocol Buffers
Hi all;

it is very painfully i write this message.
Since several days, I try to use gRPC and protobuffer3 (or 2)

the idea is simple:

I have messages (Person with name and birthday year)  and service (getAge()) , from a simple client to the server, in JAVA.
I need to use gRPC.

After several days of search, i still don't understand how it's work.

I use 3.0.0 (protoc and librarries), I tried with 2.4.1, 2.5, 2.6.2 ...
Nothing is working, I got some understandable Runtimexception.. some sample on Internet use strange libraries, incompatible with my generates code.

I need help to have a really simple Maven sample, with good versoin of libraries.
can anyone help me ?


Thanks


Nicolas Vacelet

unread,
Jun 28, 2016, 10:02:59 AM6/28/16
to Protocol Buffers
I solved my problem using this maven plugin:



<plugin>
 
<groupId>org.xolstice.maven.plugins</groupId>
 
<artifactId>protobuf-maven-plugin</artifactId>
 
<version>0.5.0</version>
 
<configuration>
 
<!--
 The version of protoc must match protobuf-java. If you don't depend on
 protobuf-java directly, you will be transitively depending on the
 protobuf-java version that grpc depends on.
 -->

 
<protocArtifact>com.google.protobuf:protoc:3.0.0-beta-2:exe:windows-x86_32</protocArtifact>
 
<pluginId>grpc-java</pluginId>
 
<pluginArtifact>io.grpc:protoc-gen-grpc-java:0.14.0:exe:windows-x86_32</pluginArtifact>
 
<outputDirectory>./src/main/java</outputDirectory>
 
<protoSourceRoot>./src/main/resources</protoSourceRoot>
 
<clearOutputDirectory>false</clearOutputDirectory>
 
</configuration>
 
<executions>
 
<execution>
 
<goals>
 
<goal>compile</goal>
 
<goal>compile-custom</goal>
 
</goals>
 
</execution>
 
</executions>
</plugin>
Reply all
Reply to author
Forward
0 new messages