如何正确配置IntelliJ IDEA以处理注释?
使用maven目标processor:process
可以正常工作,但如何在不使用IntelliJ IDEA中的maven目标的情况下处理(使用它的注释处理首选项)?
在IntelliJ的首选项/注释处理器下,我有以下设置:
选中“Enable annotation processing
”,选项“Obtain processors from project classpath
”
我将“Annotation Processors
”部分留空,因为我应该通过类路径自动找到它。
在已处理的模块下,我选择了我的Android模块,并将“target/generated-sources/apt
”选为“Generated Sources Directory Name
”。
在我的项目结构中,我设置了模块依赖项“Maven: com.googlecode.androidannotations:androidannotations:2.6
”和“Maven: com.googlecode.androidannotations:androidannotations:api:2.6
”,以便我在类路径中使用处理器。
但是构建项目不会处理注释,而是会收到警告“Annotation processing without compilation requested but no processors were found.
'
如果我尝试手动将注释处理器设置为“com.googlecode.androidannotations.AndroidAnnotationProcessor
”并选择“/path/to/libs/androidannotations-2.6-api.jar
”作为处理器的路径,我将收到错误“注释处理器”{{1尝试构建项目时“找不到”。
这是我在屏幕截图中的配置:http://imageshack.us/photo/my-images/841/intellijaa.png/
答案 0 :(得分:5)
我仍然没有使用"Obtain processors from project classpath"
工作,但是现在在手动选择处理器的路径/ jar时它正在工作。
之前我曾尝试过,但我的错误是我选择了AA-api.jar而不是常规的AA.jar。
感谢Dave,他通过AA google网上的屏幕截图给出了一个提示:
https://groups.google.com/forum/?fromgroups#!topic/androidannotations/PnAWuSQHkhg