Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to let IDEA auto import pom.xml with Annotation Processors defined

I am using QueryDsl, so my source depends on generated code.

FIRST

Whenever IDEA (auto) imports pom.xml, the following setting is always empty:

Build, Execution, Deployment -> Compiler -> Annotation Processors -> Annotation Processors

I have to set it manually, which is very troublesome.

SECOND

I have multi-modules using QueryDsl, which I want to be grouped into one profile with the QueryDsl com.mysema.query.apt.jpa.JPAAnnotationProcessor applied.

Build, Execution, Deployment -> Compiler -> Annotation Processors -> profile

I currently have to group these modules into one profile manually.

I also have to write a README and inform all members to follow the guide to set IDEA manually.


How can I config pom.xml, so that IDEA can fill these two settings automatically?

like image 828
Raymond Avatar asked Oct 11 '16 04:10

Raymond


People also ask

How do I enable annotation processing in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Compiler | Annotation Processors.

How do I enable auto import dependencies in IntelliJ?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), click Editor | General | Auto Import. Enable the Optimize imports on the fly option and apply the changes.


1 Answers

I would recommend you add .idea/* under version control as well as the project .iml file.

Annotation Processors

Annotation Processors settings are stored in .idea/compiler.xml. Having all this under CVS will make it a lot easier for other developers to open the project as they will open a project file, not a pom file, already containing project settings, run configurations, etc.

Details onto what should go in CVS and what not could be found on the official IntelliJ guide on How to manage projects under Version Control Systems

like image 109
SDekov Avatar answered Sep 22 '22 18:09

SDekov