PUML Maven Plugin
A Maven Plugin for generating diagrams from PlantUML sources
Usage
Add the plugin to your POM.
<plugin>
<groupId>it.mulders.puml</groupId>
<artifactId>plantuml-maven-plugin</artifactId>
<version>0.1</version>
<dependencies>
<!-- described below -->
</dependencies>
<configuration>
<!-- described below -->
</configuration>
</plugin>
The plugin needs two additional dependencies:
- An adapter for PlantUML
- PlantUML itself
For example:
<dependencies>
<dependency>
<groupId>it.mulders.puml</groupId>
<artifactId>plantuml-v1-adapter</artifactId>
<version>@project.version@</version>
</dependency>
<dependency>
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>1.2020.9</version>
</dependency>
</dependencies>
Finally, you can configure the plugin using the standard Maven plugin mechanism. Details are below.
The integration tests contain more examples which are verified with each build of the plugin.
Goals
This plugin provides one goal.
generate
— Generates diagrams from a set of input files.
This goal takes a set of input files and generates a diagram for each of them. You can configure the goal using these parameters:
Input | The set of input files as a FileSet |
---|---|
Name | sourceFiles |
Property | plantuml.sourceFiles |
Required? | yes |
Default value | - |
Output | Where to place generated diagrams. |
---|---|
Name | outputDirectory |
Property | plantuml.outputDirectory |
Required? | no |
Default value | ${project.build.directory}/plantuml |
Path stripping | A path to strip from each input file before building the output file name |
---|---|
Name | stripPath |
Property | plantuml.stripPath |
Required? | yes |
Default value | - |
Output format | Format the diagrams should be generated in. |
---|---|
Name | format |
Property | plantuml.format |
Required? | yes |
Default value | - |
Values | PNG , SVG |
Path stripping
The plugin will remove the stripPath
parameter from each input file name and then create the output file name from the remainder of the input file name.
To understand what this means, consider this example. Imagine an input file src/main/docs/diagrams/architecture/overview.puml and the default output directory, ${project.build.directory}/plantuml. Without path stripping, the output file would be ${project.build.directory}/plantuml/src/main/docs/diagrams/architecture/overview.puml. Path stripping lets you strip a part of the input file name, so the output location will be shorter.
In the above example, a value of src/main/docs for the stripPath
parameter would result in the following output file: ${project.build.directory}/plantuml/diagrams/architecture/overview.puml.
PlantUML Adapters
To accommodate for changing versions of PlantUML, this plugin requires you to add an adapter. It is the adapters job to abstract the actual invocation of PlantUML. This should keep the plugin API stable regardless of which version of PlantUML you want to use.
A plugin does not pull in the actual version of PlantUML. This gives you the flexibility to specify the exact version of PlantUML you want to use in your project.
Development notes
Releases must be built with Java 8 and Maven 3.x (not 4.x at the time of writing). This is due to Maven 4's build/consumer, where the distributed POM is different from the one on disk. The Maven GPG Plugin isn't aware of this yet and signs the wrong POM...
Contributing
Do you have an idea for this plugin, or want to report a bug? All contributions are welcome! Feel free to file an issue with your idea, question or whatever it is you want to contribute.
License
The PUML Maven Plugin is licensed under the Apache License, version 2. See LICENSE for the full text of the license.