如果不使用文件系统根目录的完整绝对路径,我无法将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并使用绝对路径,则一切正常。是否可以使用相对路径来代替?
发布于 2020-02-11 19:25:03
因此,这实际上是dokka的Gradle插件的问题,或者更具体地说,是Groovy字符串实现的问题。Groovy对字符串使用它自己的GStringImpl,而不是String类,这会导致在将List<GStringImpl>转换为List<String>时出现问题(此转换不会成功)。
最简单的解决方案是在您的include上调用.toString(),如下所示:
includes = ["${projectDir}/app/src/main/kotlin/com/biexpertise/simplewebview/packages.md".toString()]不过,这个问题应该在dokka方面得到解决,你可以在GitHub上提交一个错误报告
https://stackoverflow.com/questions/59307514
复制相似问题