18.8. Generating Project API Documentation
Problem
You’ve marked up your source code with Scaladoc comments, and want to generate the API documentation for your project.
Solution
Use any of the commands listed in Table 18-3, depending on your needs.
Table 18-3. Descriptions of SBT commands that generate project documentation
SBT command | Description |
---|---|
| Creates Scaladoc API documentation from the Scala source code files located in src/main/scala. |
| Creates Scaladoc API documentation from the Scala source code files located in src/test/scala. |
| Creates a JAR file containing the API documentation created from the Scala source code in src/main/scala. |
| Creates a JAR file containing the API documentation created from the Scala source code in src/test/scala. |
| Publishes artifacts to
the repository defined by the |
| Publishes artifacts to the local Ivy repository as described. See Recipe 18.15. |
For example, to generate API documentation, use the doc
command:
$ sbt doc
At the time of this writing, SBT doesn’t show where the output
from this command is written to, but with Scala 2.10.0, SBT 0.12.3
places the root index.html Scaladoc
file at target/scala-2.10/api/index.html under the
root directory of your project. Other commands, including package-doc
and publish
, do indicate where their output is
located.
The following example shows that publish-local
generates its output for a
project named “Hello” to the .ivy2 directory ...
Get Scala Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.