可以通过cmd命令来编译生成proto文件对应的编程语言的脚本
【注意没配置环境的】在编译软件protoc.exe的文件夹下打开cmd进行编辑命令输入
命令如下:
protoc.exe --java_out=编译完成后脚本所放置的文件夹路径 proto文件的全路径 --proto_path=proto文件所在文件夹的路径
例如
我要编译的proto文件的路径是D:\netty\protos\Data.proto
我想把他编译后生成的脚本放到D:\netty\myScripts 下
就这种写:
protoc.exe --java_out=D:\netty\myScripts D:\netty\protos\Data.proto --proto_path=D:\netty\protos
如果你proto文件不想编译成java脚本,就把上面命令里面的--java_out换成你想要的
you can provide one or more output directives:
--cpp_out
generates C++ code inDST_DIR
. See the C++ generated code reference for more.--java_out
generates Java code inDST_DIR
. See the Java generated code reference for more.--kotlin_out
generates additional Kotlin code inDST_DIR
. See the Kotlin generated code reference for more.--python_out
generates Python code inDST_DIR
. See the Python generated code reference for more.--go_out
generates Go code inDST_DIR
. See the Go generated code reference for more.--ruby_out
generates Ruby code inDST_DIR
. See the Ruby generated code reference for more.--objc_out
generates Objective-C code inDST_DIR
. See the Objective-C generated code reference for more.--csharp_out
generates C# code inDST_DIR
. See the C# generated code reference for more.--php_out
generates PHP code inDST_DIR
. See the PHP generated code reference for more.