Reputation: 1789
I've created a gradle modules main
that contains main program logic and codegen
that contains annotation definitions with processors. I found that:
Please note that kapt is still not supported for IntelliJ IDEA’s own build system. Launch the build from the “Maven Projects” toolbar whenever you want to re-run the annotation processing.
on kapt page (https://kotlinlang.org/docs/reference/kapt.html) but I really need it. May be there is some (may be ugly) workaround for that? Terminal background worker or prebuild tasks or something else?
P.S. This can appear as duplicate question but I really didn't found working solution at the moment
Upvotes: 2
Views: 1543
Reputation: 1789
Finally I found that repository that does work in Intellij IDEA without any workarounds (https://github.com/miquelbeltran/kotlin-code-gen-sample). Taken from https://medium.com/@Miqubel/hello-world-of-annotation-processing-in-kotlin-3ec0290c1fdd
Upvotes: 0
Reputation: 19421
At the current project we have this problem as well; we use gradle and the work around is to run gradle classes testClasses
from the commandline - either in an external terminal program or in IJ's terminal (alt-F12 on macOS). This triggers kapt as well, and when this is done I do a Build/Rebuild project from IJ's menu as well.
This is enough if the code that is processed by kapt does not change too often (we just use mapstruct and querydsl).
If you are using maven a mvn compile test-compile
should work as well.
Upvotes: 1