I want that Scaladoc generates a type hierarchy diagram for the following code snippet:
trait A
trait B extends A
But when I execute scaladoc <file>.scala
there is no type hierarchy shown - neither in A
nor in B
. How can I generate such diagrams?
First, one needs Scaladoc2 for this, which is part of Scala 2.10.
If 2.10 is installed, one also needs to pass the
-diagrams
option to Scaladoc in order to generate the diagrams. But if you do so it can be that the following error message occurs:The error occurs because Scaladoc does not generate the diagrams by itself but tries to call Graphviz, to do this job. When we add the
-diagrams-debug
flag we well get among other things the exact error message:To solve the problem one needs to install the program
dot
, which is part of Graphviz. After doing so one should be able to executescaladoc -diagrams <file>.scala
successfully and see as a result the tag "Type Hierarchy" above the member search bar in the generated documentation.Executing
scaladoc -help
shows further information for the diagrams option: