A maven plugin that generates UML diagrams from PlantUML files (text files).
Status: released to Maven Central
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>
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
Defaults for the <configuration>
element are:
- sources:
- directory:
src/main/plantuml
- includes:
**/*.puml
,**/*.plantuml
,**/*.txt
- excludes: none
- directory:
- outputDirectory:
target/generated-diagrams
- configs: none
- formats:
png
- metadata:
true
- writePreproc:
false
- preserveDirectoryStructure:
false
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
mvn clean install