Annotation Processing Build Advice: Set source and class file destinations
By Darcy-Oracle on Aug 07, 2009
In addition to following the
general build advice of setting source, target, and encoding, when running annotation processors the source and class file destination directories should be set via
-s directory and
-d directory options, respectively.
Filer, annotation processors can generate new source code to be compiled as part of the project and can also even generate new class files directly.
As recommended on the annotation processing forum, a much more hygienic build results when different kinds of generated output files are not intermixed with each other and any kind of output file is not mixed with any input files. (Input files would presumably be tracked under version control where generated files would not be.) In more detail:
Set the directory for outputting generated source files using
Set the directory for outputting generated class file code using
Do not have the source and class file output locations overlap with each other and do not have either of them overlap with the
Following these guidelines clearly delineates inputs to the compiler and outputs from the compiler.
apt has been deprecated, the same recommendations hold there too.