Kapt in modular Java 11 application

Hello,

I try to migrate my modular Java 11 (built with Gradle) application to Kotlin. Since I use Dagger2 for dependency injection I tried to use Kapt, but it failed on task kaptKotlin. There were compilation errors:

e: [module directory]/module-info.java:XX: error: module not found: XX

for every module with requires entry in my app’s module-info.java. Without Kapt I’m able to successfully build the project and my dependency injection works even with Kotlin files, so I assume Kapt is only required if Dagger2 modules are written in Kotlin (my Dagger2 module classes are Java) - is that correct?

It looks like Kapt doesn’t pass module paths to Java compiler. Is it some known issue or am I doing something wrong?

This looks like a bug, please file an issue at http://kotl.in/issue with a sample project to reproduce if possible. Thanks!

Issue created:
https://youtrack.jetbrains.com/issue/KT-32202

1 Like