首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dokka 1.4.20“无文档记录”

Dokka 1.4.20“无文档记录”
EN

Stack Overflow用户
提问于 2020-12-12 08:01:24
回答 1查看 302关注 0票数 5

Dokka 1.4.20不生成任何文档,并为所有任务返回以下内容

代码语言:javascript
复制
> Task :dokkaJavadoc
Dokka 1.4.* is an alpha project
Initializing plugins
Validity check
Creating documentation models
Exiting Generation: Nothing to document

build.gradle (项目)

代码语言:javascript
复制
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
}

它在使用1.4.20时会生成文件夹,但命令行运行和Gradle面板中的任务都不起作用。

文档还为配置指定了一堆东西,但它非常不清楚,其中有一半给了我额外的错误,比如设置输出目录。

我也尝试过0.9.17版本,但没有成功。

EN

回答 1

Stack Overflow用户

发布于 2021-03-10 18:08:52

看起来你在你的模块级build.gradle (这里是1.4.20版本)中遗漏了以下内容

代码语言:javascript
复制
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之前的版本中,您必须使用以下语法

代码语言:javascript
复制
dokka {
    outputFormat = 'html'
    outputDirectory = "$buildDir/dokka/html"

    configuration {
        includeNonPublic = false
        skipEmptyPackages = true
        skipDeprecated = true
        reportUndocumented = true
        jdkVersion = 8
    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65260195

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档