Quick Start Guide to PlantUML

For those interested in an initial exploration of PlantUML, we recommend using an online platform that directly supports PlantUML.

Explore it on our online server.

Local Installation Procedure

After trying the online version, if you're considering a more comprehensive local environment, a local installation of PlantUML is suggested. Before installation, ensure the following prerequisites are met:

Java: PlantUML requires Java to be installed on your machine.

  • Check if Java is already installed: `java -version`. The minimum version needed is Java 8.

  • If not installed, download and install it from the official Java website or through package managers like apt for Ubuntu, brew for macOS, etc.

GraphViz: Needed only for some diagrams.

  • Linux: You'll find mode information here about GraphViz installation
  • Windows: A compiled version of GraphViz is embedded within PlantUML, eliminating the need for a separate installation. However, if needed, you can acquire a standalone version here

Once ready, download the plantuml.jar file and execute it to access PlantUML’s graphical user interface. No further unpacking or installation procedures are needed.

Command Line Operations

For those familiar with command line interfaces or intending to integrate PlantUML with scripting or documentation platforms, PlantUML offers a convenient command line syntax. Follow these steps:

  1. Compose a Text File: Document your PlantUML commands. Here's a sample sequenceDiagram.txt:

@startuml
Alice -> Bob: test
@enduml

2. Execute the File: Process the aforementioned text file:

java -jar plantuml.jar sequenceDiagram.txt

3. Alternative: Launch the Graphical User Interface and select the directory that contains the text files:

java -jar plantuml.jar -gui

Upon execution, a sequenceDiagram.png containing the sequence diagram will be generated.

Explore PlantUML to further your diagramming capabilities.

Using Docker

Using Docker to test PlantUML provides an isolated environment without requiring a direct installation of PlantUML or its dependencies on your machine.

Instructions

  1. Pull the PlantUML Docker Image

There's an official Docker image for PlantUML available on Docker Hub.

docker pull plantuml/plantuml-server:jetty

This command pulls the PlantUML server image using Jetty as the server.

2. Run the PlantUML Server Container

Once the image is downloaded, you can run a container based on this image.

docker run -d -p 8080:8080 plantuml/plantuml-server:jetty

This command does the following:

  • -d: Runs the container in detached mode.
  • -p 8080:8080: Maps port 8080 of the container to port 8080 on your host machine.

3. Access PlantUML Server

Once the container is running, you can access the PlantUML server in your browser by visiting http://localhost:8080/plantuml.

You should see the PlantUML server's user interface, which allows you to type PlantUML code and see the visual representation on the fly.

4. Test Your PlantUML Code

In the PlantUML server interface:

  • Type or paste your PlantUML code into the provided text area.
  • As you type or modify the code, the diagram on the right should update automatically.

5. Stop the Container (when done)

When you're done testing your PlantUML diagrams, you might want to stop the running Docker container. First, identify the container ID:

docker ps

This command lists all running containers. Look for the plantuml/plantuml-server:jetty image in the list and note the container ID.

Now, you can stop the container:

docker stop [CONTAINER_ID]

Replace [CONTAINER_ID] with the ID of your running PlantUML container.

6. Remove the Container (optional)

If you want to remove the container entirely:

docker rm [CONTAINER_ID]

This command removes the stopped container from your machine.

PlantUML Integration Capabilities

Over the years (since 2009!), the tool has been integrated with a variety of platforms and tools, offering users flexibility and ease of use.

Here's a summary of PlantUML's integration capabilities.

  • IDE Integration:
    • IntelliJ IDEA: Plugins like "PlantUML integration" let you view and edit PlantUML diagrams directly within the IDE.
    • Eclipse: The "PlantUML Eclipse Plugin" allows for the same in the Eclipse IDE.
    • VS Code: Extensions like "PlantUML" facilitate diagram preview and other features in Visual Studio Code.
    • Others: NetBeans, and more.

  • Version Control System Integration:
    • Git: With certain extensions, you can view PlantUML diagrams in repositories without needing to render them first.
    • GitLab have PlantUML integration to view UML diagrams in markdown files directly.
    • There is a Github action that generates UML diagrams and pushes them to your repository.

  • Documentation and Wiki Tools:
    • Confluence: With the "PlantUML for Confluence" plugin, you can embed UML diagrams directly into your Confluence pages.
    • Markdown: PlantUML supports the embedding of diagrams in markdown, which can then be rendered by many platforms that support extended markdown.

  • Continuous Integration/Continuous Deployment (CI/CD):
    • Some CI/CD tools and platforms allow for the automated generation and rendering of PlantUML diagrams as part of the build or documentation process.

  • Browser Extensions:
    • There are browser extensions that can render PlantUML diagrams directly within web pages, especially useful for platforms where native integration doesn't exist.

  • Other Tools:
    • Doxygen: A documentation generator tool, Doxygen, has PlantUML integration to generate UML diagrams from annotated source code.
    • Sphinx: The Python documentation generator has plugins to integrate PlantUML diagrams.
    • AsciiDoc: With the asciidoctor-diagram extension, you can embed PlantUML diagrams in AsciiDoc documents.

  • Cloud Platforms:
    • Certain cloud platforms like GitLab provide native integration with PlantUML, allowing for rendering diagrams directly in repositories or wikis.

  • Docker:
    • Docker Image for PlantUML: There's a Docker image for PlantUML, which makes it easy to run PlantUML in a containerized environment for various purposes.

PlantUML Language Reference Guide

For an in-depth understanding of PlantUML, the PlantUML Language Reference Guide is available.

This guide provides comprehensive insights into the language, from basic syntax to advanced techniques. It's a valuable resource for all users. Acquire your copy and expand your diagramming knowledge.


Privacy Policy      Advertise