concept generate source in category ant

appears as: Generating source, generated source
Ant in Action

This is an excerpt from Manning's book Ant in Action.

Generating source from XML documents is a powerful technique. Here we’ll define the XML namespaces of the Atom drafts, the standards, and some string values for XML elements in their feeds. For every URI in the constants.xml file, we’ll define a static final URI, turning any exception from the constructor into a runtime exception.

First, Ant defines properties for all the source files for ease of reference. Then, Ant creates the destination directories under ${build.dir}. It’s critical that the generated Java source goes into a directory with the same structure as the package name declared in the XSL file, here d1/webapp/generated. We never generate Java source into a package with hand-written code, and never, never, place the generated source into a directory under SCM. These generated files are created during the build process and do not need to be managed.