简体   繁体   中英

Dokka generates docs with Java syntax instead of Kotlin

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:

在此处输入图像描述

Why and how to fix it?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM