如何使用Scaladoc生成类型层次图?
发布时间:2020-12-16 21:33:19 所属栏目:安全 来源:网络整理
导读:我想要 Scaladoc为以下代码片段生成一个类型层次结构图: trait Atrait B extends A 但是当我执行scaladoc file .scala时,没有显示类型层次结构 – 既不在A中也不在B.如何生成这样的图表? 解决方法 首先,需要Scaladoc2,这是Scala 2.10的一部分. 如果安装了2
我想要
Scaladoc为以下代码片段生成一个类型层次结构图:
trait A trait B extends A 但是当我执行scaladoc< file> .scala时,没有显示类型层次结构 – 既不在A中也不在B.如何生成这样的图表? 解决方法
首先,需要Scaladoc2,这是Scala 2.10的一部分.
如果安装了2.10,还需要将-diagrams选项传递给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... 发生错误是因为Scaladoc本身不生成图,但尝试调用Graphviz来完成此工作.当我们添加-diagrams-debug标志时,我们很好地得到了确切的错误信息: 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 要解决问题,需要安装程序点,这是Graphviz的一部分.在这样做之后,应该能够成功地执行scaladoc -gramgram< file> .scala,从而在生成的文档中查看成员搜索栏上方的标签“Type Hierarchy”. 执行scaladoc -help显示图表选项的进一步信息: -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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |