How to configure IntelliJ IDEA correctly to process annotations?

7,104 views
Skip to first unread message

Mathias Lin

unread,
Jul 15, 2012, 9:23:55 PM7/15/12
to androidan...@googlegroups.com
How to configure IntelliJ IDEA correctly to process annotations? Using the maven target processor:process works fine, but how do I process without using the maven target in IntelliJ IDEA (using it's Annotation Processing preferences)?

Under IntelliJ's preferences / Annotation Processors, I have the following setting:
"Enable annotation processing" is checked, with option "Obtain processors from project classpath"

I leave the "Annotation Processors" section empty, since it should be found through the classpath automatically I assume.
Under processed module I select my Android module and 'target/generated-sources/apt' as the 'Generated Sources Directory Name'.

In my project structure, I have the module dependencies 'Maven: com.googlecode.androidannotations:androidannotations:2.6" and "Maven: com.googlecode.androidannotations:androidannotations:api:2.6" set.

But building the project doesn't process the annotations, and instead I get a warning 'Annotation processing without compilation requested but no processors were found.'

And if I set the Annotation Processor manually to 'com.googlecode.androidannotations.AndroidAnnotationProcessor' and choosing '/path/to/libs/androidannotations-2.6-api.jar' as the path to the processor, I'm getting the error "Annotation processor 'com.googlecode.androidannotations.AndroidAnnotationProcessor' not found" when trying to build the project.

Mathias Lin

unread,
Jul 16, 2012, 12:10:03 PM7/16/12
to androidan...@googlegroups.com
David, 

thanks, that's working: if I select the jar/path manually, it's working. I had tried it before in a similar way actually, but I just see that I had chosen the wrong jar before, had chosen the AA-api-jar instead of just the AA-jar.

(I'm still wondering though why the option "Obtain processors from project classpath" isn't working, as I have the AA-jar in my maven repository, and that's linked as a dependency, so should be in the classpath. But doesn't really matter, manually selecting the path is working at least.)

Thanks again!
Mathias


On Mon, Jul 16, 2012 at 9:54 PM, David Stemmer <weefbel...@gmail.com> wrote:
Mathias,

Not sure if this helps, but this screenshot from the android-annotations-idea-test GitHub project did the trick for me:


Regards,
David

Anh Ti Em

unread,
May 4, 2014, 11:40:57 AM5/4/14
to androidan...@googlegroups.com
I found another post describing pretty details how to configure AndroidAnnotations with Intellij IDEA.


For someone who has same problem. ;). 
Reply all
Reply to author
Forward
0 new messages