2012-07-16 96 views
4

如何正確配置IntelliJ IDEA來處理註釋?如何正確配置IntelliJ IDEA以處理Android批註?

使用maven目標processor:process工作正常,但是如何在不使用IntelliJ IDEA中的maven目標(使用它的Annotation Processing偏好)的情況下進行處理?

在的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」爲路徑到處理器,當我嘗試構建項目時,出現錯誤「Annotation processor'com.googlecode.androidannotations.AndroidAnnotationProcessor'not found」。

這是我在截屏配置:http://imageshack.us/photo/my-images/841/intellijaa.png/

enter image description here

回答

5

我還沒有得到它使用"Obtain processors from project classpath"的工作,但它的手動選擇的路徑/罐時爲處理工作現在。

我之前已經嘗試過,但我的錯誤是我選擇了AA-api.jar而不是常規的AA.jar。

感謝戴夫,誰在AA谷歌組通過截圖給了一個暗示:

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

+0

你弄清楚爲什麼「獲得項目的classpath處理器」不工作? – 2012-12-25 00:17:01

+0

不,同時v12不管用了。但是Android註釋還存在一些其他問題。希望得到解決。但是,關於你的問題:不,沒有進一步研究,因爲答覆中提到的方法適用於我。 – 2012-12-26 01:52:19

相關問題