PlantUML is an open-source tool that uses simple textual descriptions to draw UML diagrams. Diagrams are defined using a simple and intuitive language.
lein-plantuml is a Leiningen plugin for generating UML diagrams using PlantUML.
Install Graphviz to use lein-plantuml 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 lein-plantuml for your project, put the following in the :plugins vector of your project.clj file:
; Use latest version instead of "X.X.X"
:plugins [[lein-plantuml "X.X.X"]]
To configure PlantUML generator, you need to setup :plantuml option as a list of triplets: "glob pattern" ["file format"] ["output directory"]
Description:
- Glob pattern is based on wildcard characters, see Glob for additional information.
- Files format is an image file format for output data (optional parameter, default value is :png). You could use both variants (keywords and text values) to configure file format.
- Output directory is an optional parameter, files will be generated in the same directory by default.
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
Example configuration:
:plantuml [["resources/*.puml" :png "target"]
["presentation/*.txt" "svg"]]
To generate UML image files using configuration from project.clj, you should use:
lein plantuml
To enable this plugin at compile stage, use the following hook:
:hooks [lein-plantuml.plugin]
To run PlantUML generator using command line interface without configuration in project.clj file, you need to use following command:
lein plantuml <source folder> [<file format>] [<output folder>]
By default, generator will use PNG output format and input directory for output files.
To show help for CLI:
lein help plantuml
To test the plugin, you can create a simple file and run lein-plantuml:
@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 lein-planuml.
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:
lein test
PlantUML developers for the really great project and adding lein-planuml on the official site.
- lein-asciidoctor - a Leiningen plugin for generating documentation using Asciidoctor.
- lein-jshint - a Leiningen plugin for running javascript code through JSHint.
- lein-jslint - a Leiningen plugin for running javascript code through JSLint.
- lein-coffeescript - a Leiningen plugin for running CoffeeScript compiler.
- lein-typescript - a Leiningen plugin for running TypeScript compiler.
- jabberjay - a simple framework for creating Jabber bots.
- coderwall-clj - a tiny CoderWall client for Clojure.
Copyright © 2014 Vladislav Bauer
Distributed under the Eclipse Public License, the same as Clojure.