如何在 Eclipse 中获得对 GPB 的支持?
我正在尝试在我的项目中使用 Google Protocol Buffers,并且希望获得 Eclipse 的一些工具支持。 特别是,我希望 Eclipse 在每次更改 .proto
文件时调用 protoc
,然后重建依赖于生成代码的所有代码。
我尝试设置一个自定义生成器,但它一直用我不明白的错误困扰我,最常见的是它抱怨 .proto
文件不在 --proto 给出的路径上-path
,据我所知应该是这样。 另外,因为我使用 ${build_files}
,Eclipse 将所有更改的文件传递给编译器(而不是我配置为触发构建的文件)。
NetBeans 似乎有一个 protobuf-Plugin,但我找不到适用于 Eclipse 的插件。 有吗?
I'm trying to use Google Protocol Buffers in my project and I'd like to have some tooling support from Eclipse. In particular, I want Eclipse to call protoc
every time I make changes to the .proto
files and then rebuild all code that depends on the generated code.
I tried to set up a Custom Builder but it keeps bugging me with errors I don't understand, most often it complains that the .proto
file is not on the path given by --proto-path
, which it should be by all I can tell. Also, because I use ${build_files}
, Eclipse passes all changed files to the compiler (instead of those that I have configured to trigger the build).
NetBeans seems to have a protobuf-Plugin, but I can't find one for Eclipse. Is there one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
googlecode上有一个protoclipse插件,处于初始阶段:
http://code.google.com/p/protoclipse/
Theres a protoclipse plugin on googlecode, which is in the initial stages:
http://code.google.com/p/protoclipse/
不确定是否有构建器,但我确实找到了协议的语法突出显示插件缓冲区。
您可以在调用 ant 任务的插件上定义外部构建器。 这是一个丑陋的拼凑,但在有更好的解决方案之前,这可能会满足您的目的。
Not sure if there is a builder, but I did find a plugin for syntax highlighting for protocol buffers.
You can define an external builder on the plugin that invokes an ant task. It is an ugly kludge, but until there is a better solution this may serve your purposes.
在实践中,语法突出显示并不是那么重要,我几乎不编辑这些文件,而且它们往往非常小。 Maven 和 m2eclipse 插件可以很好地处理构建方面的事情。
In practice, syntax highlighting turned out to not be that important, I hardly edit these files, and they tend to be very small. Maven and the m2eclipse plugin handle the building side of things great.
我建议使用 Google 的“协议缓冲区开发工具”。 它是 Eclipse 的一个插件,具有自动重新生成和错误检查等功能。 此处提供:http://code.google.com/p/protobuf-dt/。
I recommend using Google's "Protocol Buffers Development Tools". It is a plugin for Eclipse that features automagic regeneration and error checking, among other things. It's available here: http://code.google.com/p/protobuf-dt/ .
虽然这个问题与其他 用于使用 protobuf 的 Eclipse 插件很接近,但答案在这里是不同的。
嗯,是的,如果您使用 maven/gradle 调用
protoc
(Protobuf 编译器),那么您可能根本不需要 Eclipse 插件。着色编辑器有助于处理长文件或包含许多注释的文件。 知道 Eclipse 有 2 个编辑器插件。
While this question is close to other Eclipse plugin for working with protobuf, answers here are different.
Well, yes, if you use maven/gradle to invoke
protoc
(Protobuf compiler), than you may need no Eclipse plugin at all.Colorizing editor helps for long file or with many comments. Know there are 2 editor plugins for Eclipse.