Краткое руководство по PlantUML

Для тех, кто заинтересован в первоначальном изучении PlantUML, мы рекомендуем использовать онлайн-платформу, которая напрямую поддерживает PlantUML.

Изучите его на нашем онлайн-сервере.

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.

Использование Docker

Использование Docker для тестирования PlantUML обеспечивает изолированную среду, не требуя непосредственной установки PlantUML или его зависимостей на вашу машину.

Инструкции

  1. Извлеките образ PlantUML из Docker

Официальный образ Docker для PlantUML доступен на Docker Hub.

docker pull plantuml/plantuml-server:jetty

Эта команда извлекает образ сервера PlantUML, используя Jetty в качестве сервера.

2. Запуск контейнера сервера PlantUML

После загрузки образа вы можете запустить контейнер на основе этого образа.

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

Эта команда выполняет следующие действия:

  • -d : * Запускает контейнер в отсоединенном режиме.
  • -p 8080:8080 : * Сопоставляет порт 8080 контейнера с портом 8080 на хост-машине.

3. Доступ к серверу PlantUML

После запуска контейнера вы можете получить доступ к серверу PlantUML в браузере по адресу http://localhost:8080/.

Вы должны увидеть пользовательский интерфейс сервера PlantUML, который позволяет вводить код PlantUML и видеть визуальное представление на лету.

4 тестирование кода PlantUML

В интерфейсе сервера PlantUML:

  • Введите или вставьте код PlantUML в предоставленную текстовую область.
  • По мере ввода или изменения кода диаграмма справа должна автоматически обновляться.

5. Остановка контейнера (по завершении)

Когда вы закончите тестирование диаграмм PlantUML, вы можете захотеть остановить запущенный контейнер Docker. Сначала определите идентификатор контейнера:

docker ps

Эта команда выводит список всех запущенных контейнеров. Найдите в списке изображение plantuml/plantuml-server:jetty и запишите ID контейнера.

Теперь можно остановить контейнер:

docker stop [CONTAINER_ID]

Замените [CONTAINER_ID] на идентификатор запущенного контейнера PlantUML.

6. Удаление контейнера (необязательно)

Если вы хотите удалить контейнер полностью:

docker rm [CONTAINER_ID]

Эта команда удалит остановленный контейнер с вашей машины.

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