在windows上使用protobuf
2020-12-20 04:35
标签:pack multi option sage bin exe ESS package contain option java_multiple_files = true; package helloworld; // The greeting service definition. // The request message containing the user‘s name. // The response message containing the greetings 在windows上使用protobuf 标签:pack multi option sage bin exe ESS package contain 原文地址:https://blog.51cto.com/332532/2542707
二、下载protoc-gen-grpc-java-1.28.1-windows-x86_64.exe
三、编写helloworld.proto文件
内容:
syntax = "proto3";
option java_package = "com.yuhang.protobuf";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
四、在cmd执行以下命令
1)D:\work2020\proto\protoc-3.13.0-win64\bin\protoc.exe --plugin=protoc-gen-grpc-java=D:\work2020\proto\protoc-gen-grpc-java-1.28.1-windows-x86_64.exe --grpc-java_out=. helloworld.proto
获得:GreeterGrpc
2)D:\work2020\proto\protoc-3.13.0-win64\bin\protoc.exe --java_out=. helloworld.proto
获得:
HelloReply
HelloReplyOrBuilder
HelloRequest
HelloRequestOrBuilder
HelloWorldProto
上一篇:c# 误区系列(二)
文章标题:在windows上使用protobuf
文章链接:http://soscw.com/index.php/essay/37352.html