3

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

TylerH
  • 20,799
  • 66
  • 75
  • 101
Manuel Schmidt
  • 2,429
  • 1
  • 19
  • 32

3 Answers3

4

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.

gourlaysama
  • 11,240
  • 3
  • 44
  • 51
1

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

venechka
  • 1,234
  • 9
  • 13
  • Thanks for the fast reply, but it does not work. I have a `rootdoc.txt` next to my `build.sbt` and ran `sbt clean doc`. My `target/scala-2.10/api/index.html` just shows an empty package with `package org` – Manuel Schmidt May 21 '13 at 16:35
1

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.

Eric Kolotyluk
  • 1,958
  • 2
  • 21
  • 30