首页 > 解决方案 > How can I generate a GRPC Java Stubs from python project?

问题描述

I've just been following the GRPC python tutorial and I've managed to implement a python server and client (that work fine). But what I really want is a python server and a java client. However, when I run python -m grpc_tools.protoc --help there is only a --python_out option and not a --java_out.

If I do something like this protoc -I=. --java_out=. protos/*.proto it won't generate the GRPC stubs that I need for the client.


Do I need to manually copy + paste the .proto file into a java project and use the gradle plugin to generate the stubs? That doesn't seem like the right way to do it though.

标签: javapythonprotocol-buffersgrpc

解决方案


对于java客户端,需要使用java protobuf插件生成的stub,需要单独安装。你能看看这个链接吗: https ://github.com/grpc/grpc-java/tree/master/compiler


推荐阅读