What's exactly happening when I press F11 in NetBeans?
The NetBeans command to run an Ant build for a project is F11. I always believed that the target that it executes is named "default". I overrode the default target to do nothing other than simply flag that it ran. When I manually run the target from Ant, or by selecting the particular default target in Netbeans, I get the expected "flagging" behavior.
However, when I press F11, Netbeans runs the init, deps-jar, compile, and jar targets. It seems that I actually did not override the default target, as far as NetBeans is concerned.
I'm doing this so I can effectively decouple my build script fr开发者_如何学Goom my IDE, but I get the impression that NetBeans isn't helping with this.
Essentially, what I want is to override the default target so that when I press F11, targets that I specifically add are run. Is this achieved by eliminating the build-impl.xml file?
After a little luck, I figured out how to define a keyboard short-cut for custom defined targets. Create Shortcut -> Create Keyboard Shortcut does the trick. It seems to me that NetBeans has a predefined F11 target that won't change. It's as close as I'll get, but at least I have an F12 and an Ant target now.
Netbeans is actually running the dist target when you press build F11, so what you can is to override it in the build.xml file to get it to do whatever you want. Just go to build-impl.xml and copy paste the dist target to build.xml, and then modify it from there.
精彩评论