scaladoc在哪里查找rootdoc.txt以创建根文档

时间:2013-05-20 07:53:06

标签: scala packages scaladoc

这是Generate scaladoc for root package的副本,但是答案没有说明sbt doc查找rootdoc.txt的位置。

我添加了

 scalacOptions in doc ++= Seq("-doc-root-content", "rootdoc.txt")

到我的build.sbt,但sbt doc似乎没有扫描它。我试着将它放在build.sbtsrcsrc/mainsrc/main/scala

旁边

我正在使用sbt 0.12.3

3 个答案:

答案 0 :(得分:2)

似乎你的论据根本没有给scaladoc。我无法弄清楚为什么在确定范围为doc时未传递命令行参数,但如果您不将其范围限定为doc而是范围Compile,则它会起作用:

 scalacOptions in Compile ++= Seq("-doc-root-content", "rootdoc.txt")

在项目的根目录中使用rootdoc.txt

答案 1 :(得分:1)

你应该使用绝对文件路径:

scalacOptions in doc <++= baseDirectory map { d =>
  Seq("-doc-root-content", d / "rootdoc.txt" getPath)
}

这将使scaladoc在项目的根目录中查找root doc.text,也就是在build.sbt旁边

答案 2 :(得分:1)

正确的解决方案似乎是

settings(
   // Get scaladoc to add rootdoc.txt content to index.html
   scalacOptions in (Compile,doc) ++= Seq("-doc-root-content", "rootdoc.txt")
).

照顾https://github.com/pnerg/sbt-scaladoc-settings-plugin/blob/master/README.md

让我很难过,这很难理解。