Another way:
For me this was the best choise: (addingto build.xml. I've tested it on NetBeans IDE 7.0 and 7.2.1) (found it on Automatically generating source and doc jars in Netbeans )
This will create four jars, one to application program, one to sources, one to tests and one to javadoc.