One thing I dislike about Netbeans is the ant integration for single file compilation. Pain in the [insert-euphemism-for-nether-regions-here]! Okay, there’s an automatic creation of the ide-file-targets.xml — but it has required a degree of modification for most (read as ‘all’) projects I’ve worked on. Case in point — if you separate your source files from your unit tests (src & test directories for example), the default creation of this file doesn’t work (or at least it doesn’t for me). The fixed classpath in the default target exacerbates the problem, forcing one to edit the file as soon as you add jars to the project (unless you set up a dynamic classpath from the get-go).
Handling this file is, I believe, something that neither I, nor any developer, should have to deal with. It feels uncomfortably like having to hack the IDE for something that should be built in by default. Integration with ant is all very well, but I don’t think editing those project-generated ant scripts should need manual intervention except for the most unusual of circumstances. And certainly not to add single-file-compilation for code in another source directory.
By the way, in order to add another source directory (such as a ‘test’ dir) for single-file-compilation, add a new action to project.xml as follows:
compile-selected-files-in-test
files
test
.java$
relative-path
,
(This is just a copy of the action created automatically when you first pressed F9 to compile a file in the main source tree — with a new target and folder).
Then add the new target to ide-file-targets.xml:
Must set property 'files'
Note that I’m using a dynamic classpath in the above target (with a refid to the actual classpath) — whereas the default usually has a list of jar files.


