[英]Annotation Processor compilation in IntelliJ IDEA
I'm using the latest version of IntelliJ IDEA (13.1.4) and I'm developing my own custom annotation. 我正在使用最新版本的IntelliJ IDEA(13.1.4),我正在开发自己的自定义注释。
I currently have two modules on my project 我目前在我的项目中有两个模块
I was working in Eclipse but I'm trying to migrate ot IntelliJ because I can't stand Eclipse. 我在Eclipse工作,但我正在尝试迁移IntelliJ,因为我无法忍受Eclipse。 I managed to make it kinda-of work in Eclipse by having an Ant build generating the .jar file of the main project and the Test classes would use this .jar.
我设法通过让Ant构建生成主项目的.jar文件并且Test类将使用此.jar来使它在Eclipse中有点工作。
But I can't make it work on IntelliJ. 但是我不能让它在IntelliJ上工作。
In Settings -> Compiler -> Annotation Processor
I have a new profile, the test project is inside this profile, the profile is like: 在
Settings -> Compiler -> Annotation Processor
我有一个新的配置文件,测试项目在此配置文件中,配置文件如下:
I've also tried changing the Processor Path
to the output folder (where there're classes n META-INF) but no luck. 我也尝试将
Processor Path
更改为输出文件夹(其中有类META-INF),但没有运气。 The generated
folder is being created by the IDE, but it's not finding any processors. generated
文件夹由IDE创建,但它找不到任何处理器。
Any tip on how to proceed here? 关于如何在这里进行的任何提示?
I ended up finding how to do it, if anyone is interested: 如果有人有兴趣,我最终找到了如何做到这一点:
Project Structure
menu add an artifact
to the main project (the annotation processor project). Project Structure
菜单中,将artifact
添加到主项目(注释处理器项目)。 This artifact exports a .jar
file with the annotation processor. .jar
文件。 Make sure to enable Build on Make
, that way a new .jar will be generated every time you ask to Rebuild Project
Build on Make
,这样每次您要求Rebuild Project
时都会生成一个新的.jar Settings - > Compiler -> Annotation Processor
Enable annotation processing, check Processor Path
and put the path of the exported .jar
file. Settings - > Compiler -> Annotation Processor
启用注释处理,检查Processor Path
并放置导出的.jar
文件的路径。 Make sure to put the processor. and that should be all. 这应该是全部。 Now everytime
rebuilt project
is clicked a new jar is generated and the second project will be re-generated with that new jar. 现在,每次单击
rebuilt project
都会生成一个新jar,并使用该新jar重新生成第二个项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.