Search code examples
kotlingradlegradle-kotlin-dslkapt

How to use kapt in a kotlin library module


I've added kotlin("kapt") to the plugins block in the build.gradle.kts file for my library module.

plugins {
    id("java-library")
    id ("kotlin")
    kotlin("kapt")
}

Now gradle sync results in the error:

only id(String) method calls allowed in plugins {} script block

how can I make use of kapt in my library module?


Solution

  • Silly me. A copy-paste mix-up caused the .kts extension to be removed from my file. Restoring the filename extension resolves the issue.