I think what you're looking for is ant. Netbeans uses the ant build system to build and deploy the code to the robot. Netbeans just uses ant commands, which are already defined to do the tasks you mentioned above.
To build and deploy the code from my vim setup, I used ant. I don't remember exactly what shell commands I used because I deleted my setup, but you might be able to figure it out by typing "ant help". I remember that Netbeans' build window prints the ant shell command it's using before executing it.
Also see the project.xml file in the nbproject folder (
sample from my team's repo). (There should also be something similar displayed as a GUI in the project settings in Netbeans). It defines the build action as "jar-app" and the run action as "deploy" then "run". So building and deploying the code and watching it run should be as simple as:
Code:
ant jar-app
ant deploy
ant run
But I don't remember how team number setting factors in.
I'm impressed that you went to the trouble of injecting code into Netbeans to reverse-engineer the build/deploy process. It's interesting. Did you figure out what it does on FTP via Wireshark?