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:
Graphviz dot encountered an error when generating the diagram for:
_root_
These are usually spurious errors, but if you notice a persistant error on
a diagram, please use the -diagrams-debug flag and report a bug with the output.
Graphviz will be restarted...
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:
The following is the log of the failure:
Main thread in _root_: Exception: java.io.IOException: Cannot run program "dot": java.io.IOException: error=2, No such file or directory
To solve the problem one needs to install the program dot
, which is part of Graphviz. After doing so one should be able to execute scaladoc -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:
-diagrams Create inheritance diagrams for classes, traits and packages.
-diagrams-dot-path <path> The path to the dot executable used to generate the inheritance diagrams. Eg: /usr/bin/dot
-diagrams-dot-restart <n> The number of times to restart a malfunctioning dot process before disabling diagrams (default: 5)
-diagrams-dot-timeout <n> The timeout before the graphviz dot util is forcefully closed, in seconds (default: 10)
-diagrams-max-classes <n> The maximum number of superclasses or subclasses to show in a diagram
-diagrams-max-implicits <n> The maximum number of implicitly converted classes to show in a diagram