I have a custom annotation and it's processor & processorFactory. How do I configure my Ant build file such that:
The annotation processor is applied on annotated classes and generates source files inside "gen" folder
The generated source files(from annotation processing) could be used by other source files in project.
This is not pretty, but it is what I do. (Sources javac ant task javac man page) Using the compilerarg attribute I can pass in the annotation processing related arguments that are not directly supported by the javac ant task.
I do not use the APT tool because the documentation states
If you really don't care for compiler args, you can jar your annotation processors like this
Then you can do
Here's how I did it in eclipse/ant:
Notes
I found some of the other examples slightly confusing due to some of the key bits being unexplained variables. Here's what I ended up with:
to build the processor jar:
then to compile the code and run the processor:
you can take a look at the annotation processing tool , it automatically compiles the generated sourcefiles
//EDIT// In reply to your comment:
You can use apt in combination with the apt ant task
But as of jdk6 the javac tool provides direct support for annotation processing, so you should be able to use the javac ant task with the compiler attribute specified as "javac1.6"