Annotation Processors for custom source sets

Dear community,

in my project I am using an annotation processor which works perfectly for the main source set. However, all source paths of custom source sets are being ignored.

Is there a way to define an annotation processor to include additional source paths which are not part of “main”?

If you add your processor to annotationProcessor configuration, that is only for the main source set.
Each source set has its own annotation processor configuration to which you need to add the annotation processors that should be used for that source set.

Thank you very much. This was my first thought but IntelliJ did not offer the completion. This was my fault though, wrong subproject… :roll_eyes:

So it is possible to run the processor for each source set but not for all classes at the same time, correct?

Since my processor is generating an output file, is it possible to get some environment information (like the source set name) so I am able to derive a unique file name?

Ah, found it!

tasks.withType<JavaCompile> {

With this, I can receive the parameter with



Btw. consider writing your annotation processor in a way that is compatible with incremental Java compilation if possible: The Java Plugin