Question

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 so that I have the processor in my classpath.

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 try to 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.

This is my config in screenshots: http://imageshack.us/photo/my-images/841/intellijaa.png/

enter image description here

Was it helpful?

Solution

I still haven't gotten it to work using "Obtain processors from project classpath", but it's working now when selecting the path/jar to the processor manually.

I had actually tried that before but my mistake was that I had selected the AA-api.jar instead of the regular AA.jar.

Thanks to Dave, who gave a hint via screenshot on the AA google groups:

https://groups.google.com/forum/?fromgroups#!topic/androidannotations/PnAWuSQHkhg

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top