views:

2196

answers:

2

Hi guys, 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.)

A: 

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.

Gerbrand
A: 

I had exactly the same problem. The way i solved it is overriding "run" target in build.xml from my project.

<target name="run" depends="PrOJECT-impl.jar">
    <java classpath="${run.classpath}" jar="${dist.jar}">
        <sysproperty value="codebase_url" key="java.rmi.server.codebase"></sysproperty>
        <sysproperty value="policy" key="java.security.policy"></sysproperty>
    </java>
</target>

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.