5

Dokka 1.4.20 does not generate any documentation and returns the following for all tasks

> Task :dokkaJavadoc
Dokka 1.4.* is an alpha project
Initializing plugins
Validity check
Creating documentation models
Exiting Generation: Nothing to document

build.gradle (Project)

buildscript {
    // omitted a bunch of versions here
    ext.version_dokka = '1.4.20'//0.9.17//1.4.20

    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath("org.jetbrains.dokka:dokka-gradle-plugin:$version_dokka")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
plugins {
    id("org.jetbrains.dokka") version "$version_dokka"
}

allprojects {
    repositories {
        google()
        jcenter()
    }

    // used for testing 0.9.17
//    dokka {
//        outputFormat = 'html'
//        outputDirectory = "$buildDir/documentation "
//
//    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

It does generate the folders when using 1.4.20, but both command-line running as well as running the tasks in the Gradle panel do not work.

The documentation also specifies a bunch of things for configuration, but it is very unclear, and half of it gives me additional errors like setting the output directory.

I have tried version 0.9.17 as well, but with no success.

4

1 回答 1

1

似乎您在模块级别 build.gradle 中缺少以下内容(此处为 1.4.20 版)

plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id 'kotlinx-serialization'
    id 'org.jetbrains.dokka'
}

dokkaHtml {
    dokkaSourceSets {
        named("main") {
            includeNonPublic.set(false)
            skipEmptyPackages.set(true)
            skipDeprecated.set(true)
            reportUndocumented.set(true)
            jdkVersion.set(8)
        }
    }
}

android {
    compileSdkVersion 30

只需添加dokkaHtml任务。请记住,自 1.x 版以来,语法发生了显着变化。在 1.4x 之前的版本中,您必须使用以下语法

dokka {
    outputFormat = 'html'
    outputDirectory = "$buildDir/dokka/html"

    configuration {
        includeNonPublic = false
        skipEmptyPackages = true
        skipDeprecated = true
        reportUndocumented = true
        jdkVersion = 8
    }
}
于 2021-03-10T10:08:51.733 回答