When I try to use an optional task such as junit, I get a "taskdef not found" message from ant. I have tried putting ant-optional.jar in my netbeans/lib/ext director. This task works when I use it outside of netbeans, so it appears that this is a classpath error of some sort. I even tried explicitly adding a taskdef element to my build.xml file with a classpath defined and it still didn't work.
Please read the online help. Do not move ant-optional.jar; place junit.jar in netbeans/lib/ext/ and restart and it should work.
Resolved for 3.3.x or earlier, no new info since then -> closing.