PlantUML is an open-source tool that uses simple textual descriptions to draw UML diagrams. Diagrams are defined using a simple and intuitive language.
plantuml-clj is a plugin for generating UML diagrams using PlantUML.
Install Graphviz to use plantuml-clj plugin. PlantUML should be working with any version of GraphViz, starting with 2.26.3
brew install graphviz
sudo apt-get install graphviz
yum list available 'graphviz*'
yum install 'graphviz*'
To enable plantuml-clj for your project, create an alias for plantuml-clj (i.e: :plantuml), then put the following in the :extra-deps alias of your deps.edn file:
{:aliases {:plantuml {:extra-deps {plantuml-clj/plantuml-clj {:mvn/version "RELEASES"}}
:exec-fn plantuml-clj.core/plantuml
:exec-args {:input-dir "XXX"
:fmt :format
:output-dir "ZZZ"}}}}
then configure the keys :input-dir
, :fmt
and :output-dir
of your :exec-args
File formats:
- :png - Portable Network Graphics format
- :svg - Scalable Vector Graphics format
- :txt, :utxt - Text file format
- :eps, :eps:txt - Encapsulated PostScript format
- :pdf - Portable Document Format ; NOTE: broken
Example configuration:
{:aliases {:plantuml {:extra-deps {plantuml-clj/plantuml-clj {:mvn/version "1.0"}}
:exec-fn plantuml-clj.core/plantuml
:exec-args {:input-dir "resources/*.puml"
:fmt :png
:output-dir "target"}}}}
To generate UML image files using configuration from deps.edn, you should use:
clj -X:plantuml :input-dir "doc/*.puml" :fmt :png :output-dir "target/doc"
To test the plugin, you can create a simple file and run plantuml-clj:
@startuml
User -> (Start)
User --> (Use the application) : A small label
:Main Admin: ---> (Use the application) : This is\nyet another\nlabel
@enduml
Output UML diagram should look like this:
Just clone current repository and try to play with example project for better understanding how to use plantuml-clj.
More examples could be found here:
- Sequence Diagram
- Use Case Diagram
- Class Diagram
- Activity Diagram + (more)
- Component Diagram
- State Diagram
- Object Diagram
To run unit tests:
clj -X:test
lein-plantuml is an awsome Leiningen plugin for generating UML diagrams using PlantUML.