6

The official documentation states the following with respect to generating client and server code.

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.

Unfortunately, it simply suggests that one uses Maven or Gradle to generate the actual client and server stubs.

What is the actual protoc command line invocation for this generation?

merlin2011
  • 71,677
  • 44
  • 195
  • 329

1 Answers1

4

The gRPC Java Codegen Plugin for Protobuf Compiler readme file talks about this:

To compile a proto file and generate Java interfaces out of the service definitions:

$ protoc --plugin=protoc-gen-grpc-java=build/exe/java_plugin/protoc-gen-grpc-java \
  --grpc-java_out="$OUTPUT_FILE" --proto_path="$DIR_OF_PROTO_FILE" "$PROTO_FILE"
Petr Janeček
  • 37,768
  • 12
  • 121
  • 145