如何告诉 Eclipse 在启动并执行干净构建时自动生成或保留存根?
我正在开发一个使用 JavaSpace 的 Java 应用程序。我们正在 Eclipse 中开发它。在一些实例中,我们将代码插入到 JavaSpace 中以执行一些更高级的空间通知逻辑。为此,我们需要为 JavaSpace 中使用的类生成存根。我们使用外部脚本来生成这些存根。
问题是,每当 Eclipse 重新启动时,它都会对整个应用程序进行干净的构建。当它执行此操作时,它会删除所有存根,我们必须重新生成它们。
我想找到一种方法来告诉 Eclipse 不要删除 .class 文件所在的 bin 文件夹中的 _stub.class 和 _skel.class 文件。或者,或者以某种方式教 Eclipse 在重建时生成存根文件(我想每当生成存根的源文件发生变化时)。
我怎样才能做到其中之一,这样我们就不必在每次启动 Eclipse 时手动构建存根?
I'm working on a Java application that uses JavaSpace. We're developing this in Eclipse. There are a couple instances where we are inserting code into the JavaSpace to do some more advanced space notification logic. Doing this requires that we generate stubs for the classes used within the JavaSpace. We use an external script to generate these stubs.
The problem is that whenever Eclipse restarts, it does a clean build of the whole application. When it does this, it deletes all the stubs and we have to regenerate them.
I would like to find a way to either tell Eclipse not to remove the _stub.class and _skel.class files within the bin folder where the .class files are placed. Either that, or somehow teach Eclipse to generate the stub files whenever it does a rebuild (and I suppose whenever the source files from which the stubs are generated changes).
How can I do one of these, so that we don't have to manually build the stubs every time we start up Eclipse?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将脚本声明为 外部构建器 并将其添加到您的项目的建设者。
(来源:bell-labs.com< /a>)
然后,您可以配置该新构建器在项目的每次完整重新构建上运行,从而有效地取消存根文件的删除。
另一种方法是声明一个新项目 P1,仅生成、引用和编译那些额外的类,该项目将依赖于一般原始项目 P。
含义:当您重新构建 P 时,您不会触及这个用于管理生成的类的额外项目 P1。
You could declare your script as an external builder and add it to the builders of your project.
(source: bell-labs.com)
You can then configure that new builder to run on every complete re-build of the project, effectively canceling the removal of the stub files.
The other way would be to declare a new project P1 generating, referencing and compiling only those extra classes, project which would depend on the general original project P.
Meaning: when you re-build P, you do not touch this extra project P1 meant to manage the generated classes.
从 java 1.6 开始,rmi 中不再需要存根
There are no need for for stubs in rmi from java 1.6