Compile few modules via one instance of Annotation Processor

Hi.
In case of my project I need to generate code in few modules via one instance of annotation processor. It is necessary for the reason that some time during generation I need to "take a look" in the another AST and get some data out of there. By default IDEA compile each module with it's own instance of annotation processor, and hence I couldn't access to AST from another modules. On this I have a question - is it actually possible to compile few modules via one processor in IDEA?
Thanks.

1 comment
Comment actions Permalink

Hi Dmitry,

The short answer is "no".
Annotation processors are extensions to java compiler (javac or eclipse), not to IDEA's build system. Processors are discovered, created and managed directly by compiler and there is no guarantee that the same processor instance will be used for compiling different modules.
In order to resolve dependencies on classes from dependent modules a processor should use standard API provided by the compiler (ProcessingEnvironment, etc.)

0

Please sign in to leave a comment.