davidmoten / plantuml-maven-plugin

Maven plugin for generating diagram images from PlantUML files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plantuml-maven-plugin


Maven Central

A maven plugin that generates UML diagrams from PlantUML files (text files).

Status: released to Maven Central

Usage

To generate images from PlantUML source when you build your project add this to your pom.xml:

...
<build>
    <plugins>
        <plugin>
            <groupId>com.github.davidmoten</groupId>
            <artifactId>plantuml-maven-plugin</artifactId>
            <version>VERSION_HERE</version>
            <executions>
                <execution>
                    <id>generate-diagrams</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <directory>${basedir}/src/main/plantuml</directory>
                            <includes>
                                <include>**/*.puml</include>
                            </includes>
                            <excludes>
                                <exclude>**/ignore-me.puml</exclude>
                            </excludes>
                        </sources>
                        <outputDirectory>${project.build.directory}/generated-diagrams</outputDirectory>
                        <formats>
                            <format>png</format>
                            <format>svg</format>
                        </formats>
                        <preserveDirectoryStructure>false</preserveDirectoryStructure>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

PlantUML Config lines and files

If for example you want to include skin rose at the start of every plantuml file while processing then you can specify config lines or config files for that purpose.

Here's how you include skin rose at the start of every plantuml file with config lines.

This fragment goes in the maven plugin <configuration> section as above:

<configs>
  <config>skin rose</config>
</config>

Here's how you do the same using a config file rather than lines:

<configFiles>
  <configFile>src/main/plantuml/global.config</configFile>
</configFiles>

global.config:

skin rose

Configuration defaults

Defaults for the <configuration> element are:

  • sources:
    • directory: src/main/plantuml
    • includes: **/*.puml, **/*.plantuml, **/*.txt
    • excludes: none
  • outputDirectory: target/generated-diagrams
  • configs: none
  • formats: png
  • metadata: true
  • preserveDirectoryStructure: false

Minimal plugin configuration

Minimal on-demand use looks like this:

<build>
    <plugins>
        <plugin>
            <groupId>com.github.davidmoten</groupId>
            <artifactId>plantuml-maven-plugin</artifactId>
            <version>VERSION_HERE</version>
        </plugin>
    </plugins>
</build>

Then execute command:

mvn clean com.github.davidmoten:plantuml-maven-plugin:generate

How to build

mvn clean install

About

Maven plugin for generating diagram images from PlantUML files

License:Apache License 2.0


Languages

Language:Java 100.0%