问题
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 scaladoc
at 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 doc
but to Compile
:
scalacOptions in Compile ++= Seq("-doc-root-content", "rootdoc.txt")
With rootdoc.txt
at 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