This content has been marked as final. Show 4 replies
It's a bootstrapping problem. You have to have a compiled version of your annotator available to the compiler so your annotations can be processed. So you have to start by
1. Compile your annotation classes
2. Compile your annotator.
3. Compile your annotator, specifying the result of (2) as an annotation processor.
Repeat (2) and (3) as many times as necessary to get what you want out the end.
KlausM wrote:You can specify a particular processor to run using javac's "-processor" option without creating a jar file for the processor. However, in addition to source files, annotation processors can also run on class files so it would be possible for your annotation processor to be a post-pass after the build otherwise completes.
I am developing a larger application and for a certain low level implementation problem, I came up with the idea of tagging some classes with own annotations and use an annotation processor to collect these classes and store the list of them somehow. I am a complete newbie in respect to this, and as my first attempts failed, I wonder whether it is really possible to include the implementation of Processor/AbstractProcessor (with the respective annotations on its own) in the same source code as the annotations it shall process and have the compiler to find and run the processor during the compilation or whether it is mandatory to create a separate jar file with the META-INF data in order to get it work.
Thanks for any response.
You may also want to follow the recommendation on annotation processor build hygiene:
I am Chinese
@I_will_never_give_up - please don't post spam.