[英]Dokka 1.4.20 “Nothing to document”
Dokka 1.4.20 不生成任何文档并为所有任务返回以下内容
> Task :dokkaJavadoc
Dokka 1.4.* is an alpha project
Initializing plugins
Validity check
Creating documentation models
Exiting Generation: Nothing to document
build.gradle(项目)
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 面板中运行任务都不起作用。
文档还指定了一堆配置的东西,但是很不清楚,其中一半给了我额外的错误,比如设置 output 目录。
我也尝试过 0.9.17 版本,但没有成功。
似乎您在模块级别 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
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.