protoc自定义插件错误,提示“程序未找到或不可执行" [英] protoc custom plugin erroring out with Program not found or is not executable
问题描述
我正在尝试构建自定义协议插件,以从.proto文件生成自定义输出.我从协议自定义插件中复制了包含CodeGenerator的java文件作为起点,并重命名了.我还遵循了可执行文件并创建了.sh文件.我的shell脚本的内容如下.
I am trying to build a custom protoc plugin to generate custom output from .proto files. I literally copied java file containing CodeGenerator from protoc custom plugin as a starting point and renamed it. I also followed executable and created .sh file. The content of my shell script is as follows.
我还添加了PATH变量值和插件执行的输出.有人可以指出我的错误之处吗? shell脚本可以单独执行main方法正常运行
I also add the PATH variable value and output of the plugin execution. Can someone point me where I am going wrong with this? The shell script runs fine separately executing the main method
推荐答案
如果这是您的整个example.sh
,它将不起作用,因为它没有用于标识脚本解释器的"hashbang"行.
If that is your entire example.sh
, it won't work because it doesn't have a "hashbang" line identifying the script interpreter.
应该是这样的:
#!/bin/bash
set -e
java cp ...
我认为这很可能是您的问题,因为我尝试运行protoc
并以与您指定的方式相同的方式指定了一个插件,并且只要该插件实际上是自己可执行的,它就可以工作.
I think that's likely your problem because I tried running protoc
and specifying an plug-in in the same way you did, and it worked as long as the plug-in was actually executable on its own.
这篇关于protoc自定义插件错误,提示“程序未找到或不可执行"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!