Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top