Multilingual Wiki Documentation

You are currently using syntax.
In an attempt to improve PlantUML documentation...
Please do not use this website for your own diagrams.
You can click here and use the online server here for your own documentation.

Recent changes    Wiki Toc    View page history    Add new chapter    Reorder page    Raw

常见问题

F.A.Q.

PlantUML的目标是什么?

PlantUML 用于绘制UML图,使用简单易读的文本描述。 请注意,因为这不会阻止您绘制不一致的图(例如,使两个类彼此继承)。 因此,它比"建模"工具更像是"绘图"工具。

What's the goal of PlantUML ?

PlantUML is used to draw UML diagrams, using a simple and human readable text description.
Be careful, because it does not prevent you from drawing inconsistent diagrams (such as having two classes inheriting from each other, for example). So it's more a drawing tool than a modeling tool.

PlantUML Server生成的图像可以保存多长时间?

PlantUML服务器生成的png或svg的链接永远有效(只要服务器启动即可)。
但是,我们不会在服务器上存储任何图表。

这听起来可能是矛盾的。不是:整个图是压缩到URL本身。服务器接收到URL后,会对URL进行解压缩以检索图文本并生成图像。无需存储任何内容。即使服务器已关闭,您也可以使用带有[[command-line |command line]]的标志-decodeurl来检索该图。此外,图表数据存储在PNG元数据中,因此您甚至可以从下载的图像中获取它。

有时,我们可能会在服务器上激活HTTP跟踪。这主要是为了解决性能问题(如果有的话),以了解我们获得的流量。解决问题后,我们将关闭HTTP跟踪,并删除日志。

请注意,我们还计算了生成的图的数量(打印在主页上)以衡量常规服务器负载。

关于敏感内容:即使我们不存储生成的图表,也请注意所有流量都通过HTTP进行,因此很容易捕获。

因此,如果计划生成包含敏感信息的图表,则可能应该在自己的网络上安装本地服务器

How long do the images generated by PlantUML Server live for?

Links to png or svg generated by PlantUML Server are valid forever (that is as long as the server is up).
However, we do not store any diagrams on our servers.

This may sound contradictory. It is not: the whole diagram is compressed into the URL itself. When the server receives the URL, it decompresses the URL to retrieve the diagram text and generates the image. There is no need to store anything. Even if the server is down, you can retrieve the diagram using the flag -decodeurl with the command line. Furthermore, the diagram data is stored in PNG metadata, so you can fetch it even from a downloaded image.

Occasionally we may activate HTTP traces on our server. This is mainly for performance issues (when we have some) to understand the traffic we get. Once the issue solved, we turn back off HTTP traces and we remove the logs.

Note that we are also counting the number of diagrams generated (printed at the home page) to measure general server load.

Concerning sensitive content: even if we do not store the generated diagrams, please be aware that all traffic goes through HTTP, so it's easy to catch.

So you should probably install a local server on your own network if you plan to generate diagrams with sensitive information.

它不适用于我的配置!

PlantUML 已安装在各种系统上,并且一些用户在安装它时报告了较小的问题。
您可以看看[[faq-install |在此页面上]],如果出现问题,它会给出建议。

It does not work on my config !

PlantUML has been installed on various systems, and some users have reported minor issues when installing it.
You can have a look on this page which give advises if something is wrong.

我应该使用哪个版本的Graphviz?

您具有有关Graphviz [[graphviz-dot |此处]]的详细信息,以及进行[[graphviz-dot#test |此处]]的快速测试。

以下版本已经过测试,可以正常使用:

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

请注意,版本2.39和2.42 在PlantUML中无法很好地工作

With version 2.44, under Windows, you may have to run dot -c in a command line to finalize the installation, like in the following example:

You may have to run dot -c with Administrator Right.

Another option is to install Win32 version of GraphViz 2.44 which does not require this post-install process.

如果您自己编译Graphviz,则必须使用libexpat构建它,以便使用PlantUML。

Which version of Graphviz should I use ?

You have more information about Graphviz here and a quick test to do here.

The following version 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.

With version 2.44, under Windows, you may have to run dot -c in a command line to finalize the installation, like in the following example:

You may have to run dot -c with Administrator Right.

Another option is to install Win32 version of GraphViz 2.44 which does not require this post-install process.

If you compile Graphviz by yourself, you have to build it with libexpat in order to work with PlantUML.

这个成熟了吗?我没有看到任何新版本吗?

Google趋势有点积极。并且有[[https://www.google.com/search?tbm=bks&q=plantuml |几本提到PlantUML的书]]。是的,它很成熟。

请注意, PlantUML 是在考虑[[http://en.wikipedia.org/wiki/Continuous_integration |连续集成]]的情况下开发的。这意味着有很多新版本具有(希望!)向后兼容。因此文件 PlantUML.jar 可能会随着时间的推移而更改,同时保持相同的名称。

如果您想知道所使用的确切版本,可以在命令行中输入:

java -jar plantuml.jar -version

或使用以下小型特殊图表说明:

@startuml
version
@enduml

Is this mature? I don't see any new release ?

Google Trends are somehow positive. And there are few books that mention PlantUML. So yes, it's mature.

Note that PlantUML is developed with continuous integration in mind. That means that there are new releases quite often, with (hopefully!) backward compatibility. So the file PlantUML.jar may changed over time, while keeping the same name.

If you want to know the exact version you are using, you can type in the command line:

java -jar plantuml.jar -version

or use the following small special diagram description :

@startuml
version
@enduml

如何知道是否有新版本?

要检查是否有较新的版本可供下载,您可以转到下载页面

您还可以订阅以下rss流:

或者您可以使用命令行:

java -jar plantuml.jar -checkversion

该命令连接到PlantUML网站,因此您可能必须设置代理:
(请注意,必须在-jar标志之前设置-D标志)

java -Dhttp.proxyHost = myproxy.com -Dhttp.proxyPort = 8080 -jar plantuml.jar -checkversion

或使用以下小特殊图描述:

@startuml
checkversion
@enduml

您还可以使用以下语法设置代理:

@startuml
checkversion(proxy = myproxy.com,port = 8080)
@enduml

How to know if a new release is available ?

To check if a newer version is available for download, you can go to the download page.

You can also subscribe to the following rss flows:

Or you can use the command line:

java -jar plantuml.jar -checkversion

This command connects to the PlantUML website, so you may have to set your proxy :
(Please note that -D flags must be set before -jar flag)

java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=8080 -jar plantuml.jar -checkversion

Or use the following small special diagram description :

@startuml
checkversion
@enduml

You can also set your proxy using the following syntax :

@startuml
checkversion(proxy=myproxy.com,port=8080)
@enduml

我在Eclipse插件中收到一条错误消息。

如果您有以下错误消息:

当前显示的页面包含无效值

显示Windows/Preferences/PlantUML时,应尝试退出Eclipse并在命令行上使用-clean标志:

eclipse -clean

I have an error message with the Eclipse Plugin.

If you have the following error message :

The currently displayed page contains invalid values

when displaying the Windows/Preferences/PlantUML, you should try to quit Eclipse and use the -clean flag on the command line:

eclipse -clean

我想生成巨大的图表!

PlantUML将图像的宽度和高度限制为4096。您可以设置一个环境变量来覆盖此限制:PLANTUML_LIMIT_SIZE。您必须在启动PlantUML之前定义此变量,例如:

set PLANTUML_LIMIT_SIZE = 8192

要么

setenv PLANTUML_LIMIT_SIZE 8192

另一种方法是命令行中的选项:

java -DPLANTUML_LIMIT_SIZE = 8192 -jar /path/to/plantuml.jar ...

请注意,如果生成非常大的图表(例如,类似20000 x 10000像素的东西),则可能会遇到一些内存问题。解决方案是将此参数添加到java vm中:-Xmx1024m

I want to generate huge diagrams!

PlantUML limits image width and height to 4096. There is a environment variable that you can set to override this limit: PLANTUML_LIMIT_SIZE. You have to define this variable before launching PlantUML, something like:

set PLANTUML_LIMIT_SIZE=8192

or

setenv PLANTUML_LIMIT_SIZE 8192

Another way is an option in the command line:

java -DPLANTUML_LIMIT_SIZE=8192 -jar /path/to/plantuml.jar ...

Note that if you generate very big diagrams, (for example, something like 20 000 x 10 000 pixels), you can have some memory issues. The solution is to add this parameter to the java vm : -Xmx1024m.

我在重音字符方面遇到问题。

字符编码是一件微妙的事情……默认情况下,PlantUML使用平台的默认字符集,该字符集可以为UTF-8,也可以不是。如果您想知道使用的是哪个字符集,可以键入以下命令:

java -jar plantuml.jar -help

...
-charset XYZ要使用特定的字符集(默认为Windows-1252)
...

如果要使用其他字符集,例如UTF-8,则可以使用-charset标志:

java -jar plantuml.jar -charset UTF-8 ...

您还可以找到此处有关unicode的信息。请注意,即使Java 不支持B.O.M. (以UTF-8格式文件的字节顺序标记),在PlantUML中已经添加了解决方法,因此这不应该成为问题。

I have issues with accented characters.

Characters encoding is a subtle thing... By default, PlantUML use the default charset of your platform, which may or may not be UTF-8 . If you want to know which charset you are using, you can type the following command:

java -jar plantuml.jar -help

...
-charset XYZ To use a specific charset (default is windows-1252)
...

If you want to use a different charset, for example UTF-8, you can use the -charset flag :

java -jar plantuml.jar -charset UTF-8 ...

You can also find here information about unicode . Note that even if Java does not support B.O.M. (Byte Order Mark) in UTF-8 format file, a workaround has been put into PlantUML, so this should not be an issue.

我遇到亚洲字符问题。

一些日本用户报告说,在启动PlantUML之前,必须在其shell中将LANG变量设置为ja_JP.UTF-8

export LANG = ja_JP.UTF-8

由于新架构,它应该简单地起作用,因为Java知道如何绘制东亚字符。

I have issues with Asian characters.

Some Japanese users reported that they have to set the LANG variable to ja_JP.UTF-8 in their shell before launching PlantUML.

export LANG = ja_JP.UTF-8

Since the new architecture, it should simply work, because Java knows how to draw East Asian characters.

如何生成EPS?

您可以在命令行中使用-eps标志,也可以在ANT任务中使用format="eps"

How to generate EPS ?

You can use the -eps flag in the command line, or format="eps" in the ANT task.

XMI呢?

工作是进行中

What about XMI ?

Work is in progress.

是否需要在-pipe标志中使用@startuml?

简单来说:启动图时,您必须使用@startuml(或@startditaa/@startjcckit ...)。

具体来说:

@startuml/@startditaa/@startjcckit可用于确定图的类型(uml,ditaa,jcckit ...),因为您可以选择将文件名放在@startXYZ之后。这也允许在同一文件中包含多个图表。

早期版本的PlantUML不支持ditaa或jcckit。当使用-pipe标志时,由于该图是生成到标准输出的,因此标准输入中可能只有一个图。并且无需指定文件名。由于所有这些原因,当时使用-pipe标志时,不需要@startuml。

后来,已经决定对此进行标准化,并在所有位置加上@startXYZ,即使使用-pipe标志,因为这会使用户感到困惑。不幸的是,由于某些现有脚本已经使用了-pipe标志中不需要@startuml的事实,因此决定将其保留为deprecated选项,只是为了允许运行较旧的脚本。我们确实的确注意了兼容性的提升。

对于较新的脚本,您不应依赖于此,而应将@startXYZ/@endXYZ与-pipe标志一起使用。

Is @startuml needed in with -pipe flag ?

Short answer: You do have to use @startuml (or @startditaa/@startjcckit...) when starting a diagram.

Long answer:

The @startuml/@startditaa/@startjcckit is useful to determine the type of diagram (uml, ditaa, jcckit...), and because you can optionally put a filename after the @startXYZ. This also allows to have several diagrams inside the same file.

Earlier versions of PlantUML were not supporting ditaa or jcckit. When you use -pipe flag, since the diagram is generated to standard output, there could be only one diagram in the standard input. And there is no need to specify a filename. For all those reasons, @startuml was not needed when using -pipe flag at that time.

Latter, it has been decided to normalize this, and to impose @startXYZ everywhere, even with -pipe flag, because it was confusing for users. Unfortunately, since some existing scripts were already using the fact that @startuml is not needed in -pipe flag, it has been decided to keep this as a deprecated option, just to allow older scripts to run. We indeed do pay attention of ascending compatibility.

For newer scripts, you should not rely on this, and use @startXYZ/@endXYZ with the -pipe flag.

PlantUML分配给哪个许可证?

PlantUML是根据GPL许可分发的。
您可以使用命令行选项来打印许可证:

java -jar plantuml.jar -license

或者,您可以使用特殊图表:

@startuml
license
@enduml

Under which license is PlantUML distributed ?

PlantUML is distributed under the GPL license.
You can print the license using the command line option:

java -jar plantuml.jar -license

Or you can use the special diagram:

@startuml
license
@enduml

我不喜欢GPL!

您还可以使用:

这些版本缺少一些功能(例如DITAA),但是100%能够生成UML图。

您可以使用命令行选项打印这些版本的许可证:

java -jar plantuml.jar -license

或者,您可以使用特殊图表:

@startuml
license
@enduml

I don't like GPL!

You can also use:

Those versions miss few features (DITAA for example), but are 100% able to generate UML diagrams.

You can print the license of these versions using the command line option:

java -jar plantuml.jar -license

Or you can use the special diagram:

@startuml
license
@enduml

PlantUML生成的图像是否受GPL/LGPL/ASL/EPL/MIT许可保护?

不。

由PlantUML的"执行"生成的图像(无论其格式为:PNG,SVG ...)均归其相应源代码(即,以PlantUML语言编写的文字描述)的作者所有。

PlantUML的执行生成的图像被视为被覆盖的作品。您可以与他们一起做任何您想做的事。

然后可以在不参考GPL/LGPL/ASL/EPL/MIT许可的情况下使用生成的图像。甚至没有必要规定它们是由PlantUML生成的,尽管PlantUML团队将不胜感激。

有一个例外:如果某些许可证(例如GPL/LGPL/ASL/EPL/MIT)也涵盖了PlantUML语言的文本描述,则从逻辑上讲,此许可证涵盖了生成的图像。

Are images generated by PlantUML covered by the GPL/LGPL/ASL/EPL/MIT license ?

No, they are not.

Images (whatever their format : PNG, SVG...) generated by the execution of PlantUML are owned by the author of their corresponding sources code (that is, their textual description in PlantUML language).

Images generated by the execution of PlantUML are not considered as covered work. You can do whatever you want with them.

The generated images can then be used without any reference to the GPL/LGPL/ASL/EPL/MIT license. It is not even necessary to stipulate that they have been generated with PlantUML, although this will be appreciate by PlantUML team.

There is an exception : if the textual description in PlantUML language is also covered by some license (like the GPL/LGPL/ASL/EPL/MIT), then the generated images are logically covered by this license.

我可以重新分发LGPL二进制文件PlantUML.jar,是否存在任何约束?

只要不修改Java源代码和jar文件,就可以将PlantUML.jar集成到您自己的封闭源代码软件中。

唯一的限制是您必须在自己的许可证或文档中的某处提到您正在使用PlantUML,并且PlantUML是根据LGPL发行的。

然后,您甚至可以无限制地出售您的软件并赚钱(尽管在这种情况下捐赠者将不胜感激:-)

Can I redistribute the LGPL binary file PlantUML.jar and if there any constraints about it?

As long as you do not modify the Java source code and the jar file, you can integrate PlantUML.jar in your own closed source software.

The only constraint is that you have to mention somewhere in your own license or in your documentation that you are using PlantUML and that PlantUML is distributed under LGPL.

You can then even sell your software and earn money, without any other constraints (although donation will be appreciate in that case :-)

PlantUML语法的许可是什么?

PlantUML语法本身没有许可证:这意味着每个人都可以使用它。

因此,您可以在自己的代码中使用PlantUML注释:这些注释是您自己拥有的,不被视为涵盖的工作,并且不受GPL/LGPL/APL/EPL/MIT许可的约束。

GPL,LGPL,ASL,EPL或MIT仅许可当前的实现(即PlantUML程序)。另一方面,在PlantUML网站上发布的文档(示例,声明,...)受版权保护。但是您仍然可以编写自己的文档。

What is the license of the PlantUML syntax?

There are no license for the PlantUML syntax itself : this means that everybody can use it.

So you can use PlantUML comments into your own code : those comments are owned by yourself, and are not considered as covered work, and are not covered by the GPL/LGPL/APL/EPL/MIT license.

Only the current implementation (that is, PlantUML program) is licensed under GPL, LGPL, ASL, EPL or MIT. On the other hand note that the documentation (examples, notices, ...) published in the PlantUML website is copyrighted. But you can still write your own documentation.

使用Java 7运行Word宏时,出现一条错误信息:"找不到文件"!

您可能必须正确设置环境变量。要解决此问题,请进入Windows环境变量设置并找到以下两个变量:

变量名称:PATH,添加值:;C:\Program Files\Java\jre7\bin
变量名称:CLASSPATH,添加值:;C:\Program Files\Java\jre7\lib

如果它们不存在,请创建新的用户变量:

变量名称:PATH,添加值:C:\Program Files\Java\jre7\bin;
变量名称:CLASSPATH,添加到值:C:\Program Files\Java\jre7\lib;

I have a message "file not found" when running the Word Macro with Java 7!

You may have to properly set Environment Variables. To fix go into Windows Environment Variables settings and find these two variables:

Variable Name: PATH, Add to Value: ;C:\Program Files\Java\jre7\bin
Variable Name: CLASSPATH, Add to Value: ;C:\Program Files\Java\jre7\lib

If they do not exist, create new User Variables:

Variable Name: PATH, Add to Value: .;C:\Program Files\Java\jre7\bin.;
Variable Name: CLASSPATH, Add to Value: .;C:\Program Files\Java\jre7\lib.;

EmptySvgException是什么意思?

PlantUML正在使用Graphviz生成一些图。因此PlantUML正在启动dot程序,并检索dot生成的信息作为SVG流。

此消息表示PlantUML正在执行中获得空流,因此无法生成UML图。发生这种情况可能有几个原因:

*您的Graphviz安装存在问题。尝试一个非常简单的图表,例如仅一个类。 *您的Graphviz版本太旧,并且因PlantUML提供的信息而崩溃。使用testdot检查您的版本 *您的图太复杂了。
  • PlantUML和/或dot中存在错误。

What does EmptySvgException mean ?

PlantUML is using Graphviz to generate some diagrams. So PlantUML is launching dot program and retrieve the information generated by dot as a SVG flow.

This message means that PlantUML is getting an empty flow from dot execution, and therefore cannot generate UML diagrams. There may be several reasons why this happens:

  • There is an issue with your Graphviz installation. Try a very simple diagram, with only one class for example.
  • Your version of Graphviz is too old and is crashing with information provided by PlantUML. Check your version with testdot
  • Your diagram is too complex.
  • There is a bug in PlantUML and/or in dot.

我有一条错误信息来自X11或无头!

如果您在没有图形功能的Linux服务器上运行PlantUML,则可能会有一些错误消息:

  • 无法连接到X11窗口
  • X11连接由于身份验证错误而被拒绝。
  • HeadlessException

基本上,这是因为PlantUML需要访问某些图形资源(更多此处的信息)。 您可以使用标志-Djava.awt.headless = true将PlantUML设置为无头模式。 例如:

/usr/bin/java -Djava.awt.headless = true -jar /data/PlantUml/plantuml.jar ...

I have a message complaining about X11 or headless!

If you are running PlantUML on a linux server without graphical capability, you may have some error message:

  • Can't connect to X11 window
  • X11 connection rejected because of wrong authentication.
  • HeadlessException

Basically, this is because PlantUML needs to have access to some graphical resources (more information here). You can turn PlantUML to headless mode, using the flag -Djava.awt.headless=true. For example:

/usr/bin/java -Djava.awt.headless=true -jar /data/PlantUml/plantuml.jar ...

我在Mac OS X下有一个UnsatisfiedLinkError!

在Mac OS X下,如果出现以下错误消息:

Error java.lang.UnsatisfiedLinkError / liblwawt.dylib /libosxapp.dylib

您需要按照http://stackoverflow .com/questions/25914757/osx-yosemite-jvm-shared-library-does-not-contain-the-jni-createjavavm-symbol:

-下载并安装软件包:JavaForOSX。 -找到文件AptanaStidio3.ini,该文件默认位于以下目录下:/Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS -添加-vm参数以指定将用于午餐Aptana Studio的Java:-vm /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java

这似乎仅在Java 6下有效,因此您可以定义以下别名以在脚本中使用。

alias java6="export JAVA_HOME=$(/usr/libexec/java_home -v 1.6.0)"

I have an UnsatisfiedLinkError under Mac OS X !

Under Mac OS X, if you have some error message like:

Error java.lang.UnsatisfiedLinkError / liblwawt.dylib /libosxapp.dylib

You need to follow the instructions on http://stackoverflow.com/questions/25914757/osx-yosemite-jvm-shared-library-does-not-contain-the-jni-createjavavm-symbol:

  1. Download and install the package: JavaForOSX.
  2. Found the file AptanaStidio3.ini, the file by default located under the directory here: /Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS
  3. Add -vm argument to specify the java which will be used to lunch Aptana Studio: -vm /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java

This seems to work only under Java 6, so you may define the following alias to be used in your scripts.

alias java6="export JAVA_HOME=$(/usr/libexec/java_home -v 1.6.0)"

PlantUML脚本正在抢占键盘/窗口焦点!

根据您的配置,您可以尝试使用标志-Djava.awt.headless = true。 例如:

/usr/bin/java -Djava.awt.headless = true -jar /path/to/plantuml.jar ...

PlantUML scripts are grabbing keyboard/window focus!

Depending on your configuration, you can try the flag -Djava.awt.headless=true.
For example:

/usr/bin/java -Djava.awt.headless=true -jar /path/to/plantuml.jar ...

我发现了一个问题,但是由于我的图表包含机密数据,所以我无法提供显示该问题的图表

命令行中有一个-cypher选项,它生成一个.preproc文件而不是常规图像文件。

生成的.preproc文件看起来像输入图,期望所有单词(PlantUML语言关键字除外)均已被随机字母集代替。

您可以通过多次运行-cypher选项来再次检查(每次都会得到不同的文本)。 您还可以查看用于执行此转换的Cypher.java类请确保那里没有后门可用于找回原始图。

如果原始图中存在问题,则经过加密的图中也可能发生相同的问题。 由于密文实际上是毫无意义的,因此您可以安全地与我们分享该文本:我们无法猜测您的实际工作。

但是我们将能够重现此问题并解决它,以便您可以使用原始(机密)图表。

I found an issue, but I cannot provide my diagram showing the issue because my diagram contains confidential data

There is a -cypher option the command line that generates a .preproc file instead of regular image file.

The .preproc generated file looks like the input diagram expect that all words (except PlantUML language keywords) have been replaced by a random set of letters.

You can double check this by running several time the -cypher option (you will get a different text each time). You may also look at the Cypher.java class used to execute this transformation to be sure that there are no backdoor there to retrieve back your original diagram.

If there is an issue in your original diagram, the same issue is likely to also occur with the cyphered one. Since the cyphered text is really meaningless, you can safely share it with us : there will be no way for us to guess what you are really working on.

But we will be able to reproduce the issue and fix it so that you can have your original (and confidential) diagram working.

我有一个不在这里的问题!

您可以使用论坛

有人会在那里尝试回答您的问题。

I have a question that is not here!

You can use the forum facility.

Someone will try to answer your question there.


Please report any bugs to plantuml@gmail.com or here.
This website is still in beta testing.