java tutorial outdated?

20 views
Skip to first unread message

vazo...@gmail.com

unread,
Oct 28, 2019, 2:14:55 PM10/28/19
to grpc.io
Just as a heads up, it appears that the java tutorial is outdated- I got to the step where you start making stubs for the java client, and there was no RouteGuideGrpc.java file! I looked into it and apparently protobuf has changed so it requires a plugin. And the generated code docs have been updated and are correct, but the tutorial doesn't say anything about it, and in fact appears to follow the old java_generic_services functionality. 
Just thought someone might want to know. 
Thanks for all the hard work and for sharing these tools!
  -vazor

Jihun Cho

unread,
Oct 28, 2019, 3:41:53 PM10/28/19
to vazo...@gmail.com, grpc.io
Hi,

did you build from the release tags? 
after I ran `./gradlew installDist`

I can find the RouteGuideGrpc.java in the build directory. can you make sure you ran this command and your branch is a release branch?


--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/6683c6ce-f814-4b5e-a079-11654bd731a5%40googlegroups.com.

vazor

unread,
Oct 28, 2019, 4:15:41 PM10/28/19
to grpc.io
Ah no, I was doing the steps manually with a project that doesn't use gradle or maven. 

As I look back over the doc I see you did mention about the plugin, but I missed it. :( 

"Next we need to generate the gRPC client and server interfaces from our .proto service definition. We do this using the protocol buffer compiler protoc with a special gRPC Java plugin. You need to use the proto3 compiler (which supports both proto2 and proto3 syntax) in order to generate gRPC services.

When using Gradle or Maven, the protoc build plugin can generate the necessary code as part of the build. You can refer to the README for how to generate code from your own .proto files."


The README link there points to gRPC instead of protobuf, not sure if that is intentional. And for better clarity perhaps add "a special gRPC Java plugin which is downloaded separately" and "the protoc build plugin can automatically download the protoc gRPC plugin and" or something. 
Once I figured that out, I was able to find and download the protoc plugin and adjust my protoc command line to include the protoc plugin and continue the tutorial successfully. :)

Thank you!

Eric Anderson

unread,
Oct 30, 2019, 3:41:33 PM10/30/19
to vazor, grpc.io
On Mon, Oct 28, 2019 at 1:15 PM vazor <vazo...@gmail.com> wrote:
The README link there points to gRPC instead of protobuf, not sure if that is intentional. And for better clarity perhaps add "a special gRPC Java plugin which is downloaded separately" and "the protoc build plugin can automatically download the protoc gRPC plugin and" or something.

Yes, it was intentional to link to the gRPC documentation, as it needs the extra grpc-specific plugin as you've realized. It was not the goal of the tutorial to explain how to run protoc plugin manually, so it was able to gloss over the details.

For a "getting started," it is generally much better to go through the process with whatever build system it is using and then try to migrate to another build system. You may notice it also doesn't discuss Bazel, even though we have a custom plugin for Bazel as well.
Reply all
Reply to author
Forward
0 new messages