GraphViz

GraphViz是一个提供dot 程序的软件系统。

根据您要生成的图表PlantUML需要一个工作版本的 GraphViz 来生成以下图表:

对于所有其他图表,不需要也不使用 GraphViz。

Installation under Linux

There are multiple ways to install GraphViz under Linux:

  • Fedora packages: sudo yum install graphviz
  • Ubuntu packages: sudo apt install graphviz
  • Debian packages: sudo apt install graphviz

You can also build it from the source. If you do, you have to build it with libexpat in order to work with PlantUML.

By default, the dot executable is expected:

  • Firstly in: /usr/local/bin/dot
  • Then in: /usr/bin/dot

You can also specify the environment variable GRAPHVIZ_DOT to set the exact location of your GraphViz executable.

Installation under Mac

You can easily install GraphViz by installing brew on your Mac machine. This could fix issues if you have installed GraphViz as .dmg package.

brew install libtool
brew link libtool
brew install graphviz
brew link --overwrite graphviz

By default, the dot executable is expected:

  • Firstly in: /usr/local/bin/dot
  • Then in: /usr/bin/dot

You can also specify the environment variable GRAPHVIZ_DOT to set the exact location of your GraphViz executable.

Testing

To have information about where PlantUML expects to find dot, you can use the command line:

java -jar plantuml.jar -testdot

You can also use this special diagram description:

🎉 Copied!

@startuml
testdot
@enduml

Try to launch dot command into a command shell. You may have to finalize the installation by typing dot -C.

You can also specify the environment variable GRAPHVIZ_DOT to set the exact location of your GraphViz executable.

新的基于 Java 的图表生成引擎 "Smetana"

自 1.2021.5 版起,如果您为支持的类型在图表中添加了!pragma layout smetana ,您可以尝试使用 PlantUML 而无需安装 Graphviz。在这种情况下,使用的是"Smetana" 引擎,而不是 Graphviz。如果这对您有效,您可以跳过下面的章节。

Windows 下的安装

从 1.2020.21 开始

如果您使用的是最近的版本(至少是 1.2020.21 版),您就不需要再手动安装 GraphViz 了!

一个最小化的 graphviz dot.

这确实是 Windows 下的首选。

</zstrong>注意<zstrong>:在 1.2020.25 之前,图形生成过程中会出现错误信息,因此请使用 1.2020.25 或更高版本。

较旧的 PlantUML 版本

对于较旧的版本,您必须自行安装 GraphViz。您可以选择:

使用 x64 版本时,您可能需要在命令行中运行dot -c (带管理员权限)才能完成安装,如以下示例:

要检索dot.exe ,PlantUML 会扫描您的c:\ 驱动器并搜索c:\*\graphviz*\bin\dot.exec:\*\graphviz*\release\bin\dot.exe 。这不是递归的:您必须使用根目录下的文件夹。

另一个选择是指定环境变量GRAPHVIZ_DOT 来设置 GraphViz 可执行文件的确切位置。

Important note about version

The following GraphViz versions have been tested, and are known to work:

  • 2.26.3
  • 2.28
  • 2.30.1
  • 2.34
  • 2.36
  • 2.38
  • 2.44

Note that versions 2.39 to 2.42 do not work very well with PlantUML.

If you find something wrong, thanks for sending us a note or posting a message on the forum.


Privacy Policy      Advertise