首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Gradle为包文档配置Dokka?

如何使用Gradle为包文档配置Dokka?
EN

Stack Overflow用户
提问于 2019-12-12 23:06:27
回答 1查看 737关注 0票数 2

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

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

代码语言:javascript
复制
> 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并使用绝对路径,则一切正常。是否可以使用相对路径来代替?

EN

回答 1

Stack Overflow用户

发布于 2020-02-11 19:25:03

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

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

代码语言:javascript
复制
includes = ["${projectDir}/app/src/main/kotlin/com/biexpertise/simplewebview/packages.md".toString()]

不过,这个问题应该在dokka方面得到解决,你可以在GitHub上提交一个错误报告

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59307514

复制
相关文章

相似问题

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