I have been trying to find the correct settings for IntelliJ\'s annotation processing in order for it to co-exist with Gradle\'s build process.
Whenever I build from Int
After importing your Gradle project under IDEA do the following steps:
Set annotation processing configuration as follows:
Run menu: Build - Build Project
Right click on each new generated folder and select: Mark Directory as - Generated Sources Root so it was marked as follows:
/generated
to project's .gitignore fileThat's a minimal viable configuration which will provide full IDE support for generated classes. The drawback is, whenever Gradle project gets re-imported the generated folders will need be marked as Generated Sources Root again. Perhaps this can be improved with adding these paths as source sets under build.gradle.
Sometimes it happens that IDEA modules lose their compiler output path settings in result of the above. It's sufficient to just set it back to their default folders.