【发布时间】:2015-09-10 20:09:10
【问题描述】:
我刚开始玩 google proto。当我尝试编译 proto-java 示例中存在的 proto 文件时,它不会生成任何 grpc 文件。
原始文件, https://github.com/grpc/grpc-java/blob/master/examples/src/main/proto/hello_world.proto
终端输出,
rsonkhla@raman-OptiPlex-9020:~/sandbox/grpc-java/examples$ protoc --version libprotoc 3.0.0 rsonkhla@raman-OptiPlex-9020:~/sandbox/grpc-java/examples$ protoc --java_out=test/ -I../../grpc-java/examples ../../grpc-java/examples/src/main/proto/hello_world.proto rsonkhla@raman-OptiPlex-9020:~/sandbox/grpc-java/examples$ ls -R test/ 测试/:io
测试/io:grpc
test/io/grpc:示例
test/io/grpc/examples: helloworld
test/io/grpc/examples/helloworld: HelloRequest.java
HelloResponse.java HelloWorldProto.java HelloRequestOrBuilder.java HelloResponseOrBuilder.java
还有其他人遇到过这个问题吗?
【问题讨论】:
-
请忽略。我在编译时没有传递 protoc-gen-grpc-java 插件路径...
-
rsonkhla@raman-OptiPlex-9020:~/sandbox/grpc-java/examples$ protoc --plugin=protoc-gen-java_rpc=../compiler/build/binaries/java_pluginExecutable/protoc- gen-grpc-java --java_rpc_out=test/ --java_out=test/ -I. src/main/proto/hello_world.proto test/io/grpc/examples/helloworld: GreeterGrpc.java HelloRequest.java HelloRequestOrBuilder.java HelloResponse.java HelloResponseOrBuilder.java HelloWorldProto.java
-
我用的是protobuf-maven-plugin,也无法生成服务存根文件。
标签: protocol-buffers grpc protoc