Skip to content

vbauer/lein-plantuml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lein-plantuml

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.

Build Status Clojars Project

Pre-requirements

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*'

Installation

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"]]

Configuration

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"]]

Usage

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

Examples

Detailed example

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:

uml-example

Example project

Just clone current repository and try to play with example project for better understanding how to use lein-planuml.

Useful links

More examples could be found here:

Unit testing

To run unit tests:

lein test

Thanks to

PlantUML developers for the really great project and adding lein-planuml on the official site.

Might also like

  • 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.

License

Copyright © 2014 Vladislav Bauer

Distributed under the Eclipse Public License, the same as Clojure.