Execute kapt/kapt2 from within IJ


#1

How can I get the Kotlin annotation processor to run from IJ?

“Enable annotation processors” in Settings does not seem to work.


#2

This is currently unsupported. What’s your use case? Why can’t you use Gradle to build your project?


#3

Ok thanks. I am using Dagger2. I am using Gradle to build the project (which works fine), however it’s nice when working in the IDE to not switch out of it to do the annotation processing.


#4

What do you mean by “switch out of it”? You can run the Gradle build from within IntelliJ IDEA using the Gradle toolwindow.


#5

Yes of course you’re right. I meant “switch out of it” in terms of task context i.e. IJ just automatically does so much automatically, it feels weird to have to call out to my build (even if from within IJ) to do something.

In any case, I’ve set it up so that the gradle task will run automatically when I do “Rebuild”, which works perfectly well.


#6

Are there any plans to implement support for this? We have integrated kapt into our build process, but out of the box, the IntelliJ build system is the default and people expect it to work (it’s also a lot faster, IMO, but that may be an artifact of the old version of gradle we’re stuck on until 1.0.7 or we can upgrade to 1.1). Currently you get missing files and it’s not an intuitive error or cause. In every other area gradle and IJ Build system are equivalent so it seems odd to not have it work for this.