Dokka 1.4.20 "Nothing to document"

1k views Asked by At

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.

1

There are 1 answers

5
Bernhard On

Seems like you're missing the following in your module level build.gradle (here for version 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

Just add the dokkaHtml task. Keep in mind syntax has significantly change since version 1.x. In version prior to 1.4x you will have to use the following syntax

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

    configuration {
        includeNonPublic = false
        skipEmptyPackages = true
        skipDeprecated = true
        reportUndocumented = true
        jdkVersion = 8
    }
}