A way to trigger Annotation processing
I've been looking through the documentation of Intellij 12 but i couldn't find my answer. I'm currently using Intellij 12 with AndroidAnnotations on an Android Project. The project consists of multiple modules, but only 1 uses the Annotations, the rest are libraries an dependencies.
When I rebuild the entire project, the annotations are regenerated. But this takes quite much longer then making my main module and running it. I'm looking for a way to regenerate the annotations on command (by action or ant), so i can include that on my run configuration.
I remember using Intellij 11 and that would regenerate the annotations on every run, but 12 seems to handle things differently.
Please sign in to leave a comment.
Hi Tristan,
Yes, now annotations are handled not in a separatre compiler (javac) run, but together with java code compilation (as it was supposed to work by the authors of annotation processing API).
You need too create an "enabled" annotation processing profile and associate all needed modules with it. Annotation processors will be discovered by javac from the specified classpath and run during compilation.
Eugene.
Hi, I think I went through all the possible options, but can't get it to work.
I have a jar file in a additional folder, this file holds the annotation processor.
So this file is (with full path) put in the Compiler>Annotation Processors>Processor path.
In my case it's the C:\Prj\Android Java\FalconOil\AnnotationProc\compot-apt.jar file (to make everything fully clear).
In this file there are two processors.
com.compot.model.StaticMetamodelAnnotationProcessor
com.compot.model.MetamodelBuilderAnnotationProcessor
Production sources directory box. And select the Module content root option.
OK, so needles to say I enabled the Enable annotation processing box (else I would not be able to fill in any of the above mentioned options)
Then in the Project Structure dialog under Modules I add the compotGen folder to the source folders under the 'Add Content Root'
But now, at first when I do a Build, Rebuild Project I get the following error
java: java.lang.RuntimeException: javax.annotation.processing.FilerException: Attempt to recreate a file for type com.compot.CompotStaticModel
When I try this project in Eclipse everything works like a breeze.
Where do I have to do what to get my annotions processed with IntelliJ IDEA 12.1.4???