2

如果不使用来自文件系统根目录的完整绝对路径,我无法将 Dokka 配置为包含我的包的文档。我的 Gradle 文件中有(该includes行有问题):

dokka {
    outputFormat = 'html'
    outputDirectory = "$projectDir/../doc"


    configuration {
        // Use to include or exclude non public members.
        includeNonPublic = false

        // Do not output deprecated members. Applies globally, can be overridden by packageOptions
        skipDeprecated = false

        // Emit warnings about not documented members. Applies globally, also can be overridden by packageOptions
        reportUndocumented = true

        // Do not create index pages for empty packages
        skipEmptyPackages = true

        includes = ["${projectDir}/app/src/main/kotlin/com/biexpertise/simplewebview/packages.md"]
    }
}

./gradlew dokka什么时候,如果我有这个错误,我会运行:

> Task :app:dokka FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dokka'.
> org.codehaus.groovy.runtime.GStringImpl cannot be cast to java.lang.String

如果我删除$projectDir并使用绝对路径,则一切正常。可以改用相对路径吗?

4

1 回答 1

0

所以这实际上是 dokka 的 Gradle 插件的问题,或者更具体地说,是 Groovy String 实现的问题。Groovy 使用它自己GStringImpl的字符串而不是类,这会在将 a转换String为时导致问题(此转换不成功)。List<GStringImpl>List<String>

最简单的解决方案是调用.toString()您的包含,如下所示:

includes = ["${projectDir}/app/src/main/kotlin/com/biexpertise/simplewebview/packages.md".toString()]

不过,这应该在 dokka 方面得到修复,您可以在 GitHub 上提交错误报告

于 2020-02-11T11:25:02.980 回答