Dokka generates docs with Java syntax instead of Kotlin

649 Views Asked by At

I have a module with Kotlin code, and Dokka integrated.

When I'm running ./gradlew :core:clean :core:dokkaHtml I'm getting following output with Java syntax, while this code is pure Kotlin:

enter image description here

Why and how to fix it?

1

There are 1 best solutions below

0
On

According to the dokka readme:

Applying plugins Dokka plugin creates Gradle configuration for each output format in the form of dokka${format}Plugin:

dependencies {
    dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.10")
}

You can also create a custom Dokka task and add plugins directly inside:

val customDokkaTask by creating(DokkaTask::class) {
    dependencies {
        plugins("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.10")
    }
}

Please note that dokkaJavadoc task will properly document only single jvm source set

To generate the documentation, use the appropriate dokka${format} Gradle task:

./gradlew dokkaHtml