Where does scaladoc look for the rootdoc.txt to create the root doc

最后都变了- 提交于 2020-01-04 06:27:08

问题


This is a duplicate of Generate scaladoc for root package, however the Answer does not state where sbt doc looks for the rootdoc.txt.

I added

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

to my build.sbt, but sbt doc does not seem to scan it. I tried to put it next to the build.sbt, in src, src/main, src/main/scala

I am using sbt 0.12.3


回答1:


It seems that your arguments are not given to scaladocat all. I cannot figure out why the command line arguments are not passed when scoping to doc, but it works if you do not scope it to docbut to Compile:

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

With rootdoc.txtat the root of your project.




回答2:


you should use an abolute file path:

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

this will make scaladoc look for rootdoc.txt in the root of the project, aka next to build.sbt




回答3:


The correct solution seems to be

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

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

It saddens me this was so hard to figure out.



来源:https://stackoverflow.com/questions/16644948/where-does-scaladoc-look-for-the-rootdoc-txt-to-create-the-root-doc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!