<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
This section describes any Java-language-specific aspects of the project.
http://www.netbeans.org/ns/freeform-project-java/1
can be used as well, for
compatibility with older IDE versions, but lacks some features; refer to the
schemas for details.
<compilation-unit>
can be listed one or more times
in the <java-data>
section.
A compilation unit is a collection of Java source roots which
are compiled at once and share the same classpath and other attributes.
<compilation-unit> <package-root>${src.dir}</package-root> <classpath mode="compile">${lib.dir}/x.jar:${lib.dir}/y.jar</classpath> <built-to>${classes.dir}</built-to> <built-to>${jar.file}</built-to> <javadoc-built-to>${javadoc.dir}</javadoc-built-to> <source-level>1.5</source-level> </compilation-unit>
Declares that the directory named by ${src.dir}
contains Java sources. They are
expected to be compiled using the named classpath (as usual, /
and \
can be
used interchangeably, as can :
and ;
), so the IDE can offer code completion
and other features accordingly.
The classes will be compiled to the directory
${classes.dir}
and later packed into ${jar.file}
, so any other project using
either of these locations in its classpath will show sources from ${src.dir}
in
code completion, Go to Source, etc.
Javadoc may be built to the directory
${javadoc.dir}
, so if other projects use this source root, and ${javadoc.dir}
exists, it may be used in Javadoc search.
The sources are to be compiled with
-source 1.5
, i.e. they may contain generics and other JDK 5 language features.
It is important to specify an accurate <built-to>
(available in the Properties dialog
in the Output tab) even if no other code compiles against the output. This is because
the IDE’s background Java parser can run much faster on large source trees when most of the classes have
been compiled already and it knows where they are.