4

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

Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192

1 Answers1

5

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

Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192
  • Did you figure out why the "Obtain processors from project classpath" doesn't work? – Wojciech Górski Dec 25 '12 at 00:17
  • No, meanwhile v12 is out anyway. But there are some additional issue with Android Annotations. Hoping for a fix. But regarding your question: no, haven't looked further into it, since the approach as mentioned in by reply works for me. – Mathias Conradt Dec 26 '12 at 01:52