Netbeans、Ant 和 RMIC(Java RMIC 编译器)(帮助)
我现在很生气/困惑。
我有一个 Netbeans 项目,编译得很好。 我编辑了 build.xml 文件来创建一个“-post-compile”目标,该目标执行 rmic ant 任务。
所以现在,当我“清理和构建”时,它会编译我的主代码,然后为我生成 rmic 存根。
然而,当我选择使用 netbean 的对话框“运行”我的 netbeans 项目时,我的存根文件神奇地消失了。 (但已编译的类仍然保留)然后它尝试运行我的应用程序,这当然会失败,因为现在缺少所需的存根文件。
这是一个 netbeans 管理的项目(不是自由格式的 ant 应用程序)。 我已经指定了我想要“运行”的课程。 这基本上是我唯一的选择。
我尝试过:
<target name="-post-compile">
<rmic classname="RTIController.Lane_Assignment_Strategy.Impl_Lane_Assignment_Strategy_Dist_FirstFlow" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Road" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Lane" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Veh_Source" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Veh_Sink" base="${build.classes.dir}"/>
<rmic classname="RTIController.Timing_Event.Adapter_Timing_Event_Source" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Vehicle.Impl_Vehicle_Car" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Vehicle.Impl_Vehicle_Truck" base="${build.classes.dir}"/>
</target>
<target name="run" depends="init,compile,graphicalMapper-impl.run"/>
在 build.xml 内(覆盖 build-impl.xml)。
任何人都能够阐明这个主题吗? 另一方面,当我通过('ant run')之类的命令运行 Ant 时,它工作得很好。 (是否进行初始化、编译、后编译和运行。)
在尝试让 Netbeans“运行”应用程序时检查 Ant 调试日志时,它似乎只执行任务“运行”。 (显然,这似乎不是我提供的覆盖“运行”。
我非常感谢有关此主题的任何帮助,因为单独编译和运行会适得其反。(目前在 netbeans 中进行开发并使用 cmdline ant 来构建和运行。)
I'm rather miffed / baffled at the moment.
I've got a Netbeans project, that compiles fine.
I've edited the build.xml file to create a "-post-compile" target, which does an rmic ant task.
So now, when I "clean and build" it compiles my main code, then generates the rmic stubs for me.
However, when I chose to 'Run' my netbeans project, using netbean's dialouges, my stub files magically disappear. (Yet the compiled classes still remain) Then it tries to run my application, which of course, fails, since the required stub files are now missing.
This is in a netbeans managed project (not a free-form ant app). I've specified the class I'd like to 'run.' And that is essentially the only options I'm given.
I've tried:
<target name="-post-compile">
<rmic classname="RTIController.Lane_Assignment_Strategy.Impl_Lane_Assignment_Strategy_Dist_FirstFlow" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Road" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Lane" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Veh_Source" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Veh_Sink" base="${build.classes.dir}"/>
<rmic classname="RTIController.Timing_Event.Adapter_Timing_Event_Source" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Vehicle.Impl_Vehicle_Car" base="${build.classes.dir}"/>
<rmic classname="MappingModel.Impl_SimObjectPackage.Impl_Vehicle.Impl_Vehicle_Truck" base="${build.classes.dir}"/>
</target>
<target name="run" depends="init,compile,graphicalMapper-impl.run"/>
inside the build.xml (to override the build-impl.xml).
Anyone able to shed some light on this subject?
On another note, when I run Ant via command like ('ant run') it works fine. (Does the init,compile, post-compile and run.)
When inspecting the Ant debug logs when trying to get Netbeans to 'run' the app, it appears only to execute task 'run.' (Which, obviously does not seem to the the overriden 'run' i've provided.
I'd greatly appreciate any help on this subject, as compiling and runing separately is quite counter productive. (Currently dev'ing in netbeans and using cmdline ant to build and run.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是一个大胆的猜测(因为我已经有一段时间没有使用 RMI 了),因为不再需要 Java 1.5 RMI 存根类。 它们是自动生成的。 这可能是 netbeans 删除它们的原因。
您可以尝试从 build.xml 中删除 rmic ant 任务引用。
Just a wild guess (as I haven't used RMI since a while), since Java 1.5 RMI Stub classes are no longer needed. They're automatically generated. This might be the reason netbeans removes them.
You can try remove the rmic ant tasks references from you're build.xml.
我有完全相同的问题。
我解决这个问题的方法是覆盖我的项目中 build.xml 中的“run”目标。
然而,问题仍然没有完全解决,因为使用上下文菜单或 F6 仍然会删除存根和骨架文件。 您需要直接从 build.xml 文件运行“run”目标。
I had exactly the same problem.
The way i solved it is overriding "run" target in build.xml from my project.
However, problem is still not completely solved since using context menu or F6 will still delete stub and skeleton files. You need to run "run" target directly from build.xml file.