项目地址:

  • 时序图:多进程流程梳理

  • 活动图:代码流程梳理

  • 思维导图

使用 Docker 安装

  1. 拉取 PlantUML 的 Docker 镜像
1
docker pull plantuml/plantuml-server:jetty
  1. 运行 PlantUML 服务器容器
1
docker run -d -p 8080:8080 plantuml/plantuml-server:jetty
  1. 访问 PlantUML 服务器

时序图

注释信息

note left

1
2
3
4
5
6
@startuml

Alice->Bob : hello
note left: this is a first note

@enduml

note right

1
2
3
4
5
6
@startuml

Bob->Alice : ok
note right: this is another note

@enduml

end note (多行注释)

1
2
3
4
5
6
7
8
9
10
@startuml

Bob->Bob : I am thinking
note left
a note
can also be defined
on several lines
end note

@enduml

分支

alt/else/end

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@startuml
Alice -> Bob: 认证请求

alt 成功情况
Bob -> Alice: 认证接受
else 某种失败情况
Bob -> Alice: 认证失败
group 我自己的标签
Alice -> Log : 开始记录攻击日志
loop 1000次
Alice -> Bob: DNS 攻击
end
Alice -> Log : 结束记录攻击日志
end
else 另一种失败
Bob -> Alice: 请重复

end
@enduml

对消息序列编号

autonumber

1
2
3
4
5
6
7
@startuml

autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response

@enduml

autonumber inc

  • 要增加第一个数字,请使用:autonumber inc A 。
  • 要增加第二位数字,请使用:autonumber inc B 。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@startuml

autonumber 1.1.1
Alice -> Bob: Authentication request
Bob --> Alice: Response

autonumber inc A
'Now we have 2.1.1
Alice -> Bob: Another authentication request
Bob --> Alice: Response

autonumber inc B
'Now we have 2.2.1
Alice -> Bob: Another authentication request
Bob --> Alice: Response

autonumber inc A
'Now we have 3.1.1
Alice -> Bob: Another authentication request
autonumber inc B
'Now we have 3.2.1
Bob --> Alice: Response

@enduml

autonumber stop

  • 停止自动编号

活动图

开始/结束

1
2
3
4
5
6
7
8
9
@startuml

start
:Hello world;
:This is defined on
several **lines**;
end

@enduml

条件判断

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@startuml

start

if (Graphviz installed?) then (yes)
:process all\ndiagrams;
else (no)
:process only
__sequence__ and __activity__ diagrams;
endif

stop

@enduml

switch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@startuml

start

switch (测试?)
case ( 条件 A )
: Text 1;
case ( 条件 B )
: Text 2;
case ( 条件 C )
: Text 3;
case ( 条件 D )
:Text 4;
case ( 条件 E )
:Text 5;
endswitch

stop

@enduml

思维导图

1
2
3
4
5
6
7
8
9
10
11
12
13
@startmindmap

* Root 1
** Foo
***_ 1
** Bar
***_ 2

* Root 2
** Lorem
** Ipsum

@endmindmap