私はScaladocは、次のコードスニペットの型階層図を生成することを望む:Scaladocで型階層図を生成するには?
trait A
trait B extends A
しかし、私はscaladoc <file>.scala
を実行したときに表示型には階層はありません - A
でもB
でもないが。どのようにしてそのような図を生成できますか?
私はScaladocは、次のコードスニペットの型階層図を生成することを望む:Scaladocで型階層図を生成するには?
trait A
trait B extends A
しかし、私はscaladoc <file>.scala
を実行したときに表示型には階層はありません - A
でもB
でもないが。どのようにしてそのような図を生成できますか?
まず、Scala 2.10の一部であるScaladoc2が必要です。
2.10がインストールされている場合は、図を生成するために-diagrams
オプションをScaladocに渡す必要があります。 Scaladocは、それ自体で図を生成しないので
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...
エラーが発生したが、この仕事をするために、Graphvizを呼び出そうとし:あなたがそうなら、それは、次のエラーメッセージが発生することもできます。 1はGraphvizのの一部であるプログラムdot
を、インストールする必要がある問題を解決するために
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
:我々は-diagrams-debug
フラグを追加すると、我々は他のものの間で正確なエラーメッセージが表示されます。その後、scaladoc -diagrams <file>.scala
を正常に実行し、生成されたドキュメントのメンバー検索バーの上に "Type Hierarchy"というタグが表示されるようになります。
-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
:実行
scaladoc -help
は図オプションの詳細を示しています