Class diagram generator mojo

If you want to use the plantuml-generator-maven-plugin for class diagram generation, you need to configure this plugin as any normal maven plugin as part of your build and add this plugin specific configuration:

  • required configuration parameters:

    • outputFilename - the file name of the diagram generated by this plugin; required

  • mutually exclusive configuration parameters

    • scanPackages - a string list of all packages which should be used to generate the class diagram; required in conjunction with the blacklist regular expression and optional with the whitelist regular expression

    • whitelistRegexp - a regular expression to filter all classes in the classpath which should be part of the diagram (processing can be speed up with the scanPackages configuration); optional
      if a whitelist regular expression is configured the blacklist regular expression is ignored!

    • blacklistRegexp - a regular expression to remove classes from the list of classes in the diagram - works only if the configuration parameter scanPackages is not empty and no whitelist regular expression is defined; optional

  • optional configuration options:

    • additional-planuml-configs+ this parameter allows to add special plantuml configuration options to the beginning of the plantuml diagram like 'left to right direction'.

    • addJPAAnnotations - a boolean to express if JPA-annotations should be shown in the diagram; optional - Default false
      Currently implemented JPA Annotations are

      • javax.persistence.Column,

      • javax.persistence.Id,

      • javax.persistence.Transient,

      • javax.persistence.OneToOne,

      • javax.persistence.OneToMany,

      • javax.persistence.ManyToMany,

      • javax.persistence.ManyToOne,

      • javax.persistence.Entity,

      • javax.persistence.Table,

      • javax.persistence.MappedSuperclass,

      • javax.persistence.Index and

      • javax.persistence.UniqueConstraint

      • jakarta.persistence.Column,

      • jakarta.persistence.Id,

      • jakarta.persistence.Transient,

      • jakarta.persistence.OneToOne,

      • jakarta.persistence.OneToMany,

      • jakarta.persistence.ManyToMany,

      • jakarta.persistence.ManyToOne,

      • jakarta.persistence.Entity,

      • jakarta.persistence.Table,

      • jakarta.persistence.MappedSuperclass,

      • jakarta.persistence.Index and

      • jakarta.persistence.UniqueConstraint

      Index, UniqueConstraint, Tablename and Tableschema are show as tagged values in a separate compartment

    • addValidationAnnotations - a boolean to express if Validation annotations should be used for cardinality in the diagram; optional - Default false
      Currently implemented Validation Annotations are

      • javax.validation.constraints.Size,

      • javax.validation.constraints.NotEmpty

      • jakarta.validation.constraints.Size

      • jakarta.validation.constraints.NotEmpty

    • asciidocDiagramBlockDelimiter - defines the block delimiter of the asciidoc diagram block - default is ----; optional (only used when enableAsciidocWrapper is true);

    • asciidocDiagramImageFormat - the image format (png/svg/latex etc.) - default is png; optional (only used when enableAsciidocWrapper is true);

    • asciidocDiagramName - the name of the diagram in the asciidoc diagram block - default is outputFilename + "." + asciidocDiagramImageType;optional (only used when enableAsciidocWrapper is true);

    • enableAsciidocWrapper - a boolean which defines if the generated diagram should be wrapped by an asciidoc diagram block - default is false; optional;

    • enableMarkdownWrapper - a boolean which defines if the generated diagram should be wrapped by an markdown diagram block - default is false; optional;

    • fieldBlacklistRegexp - a regular expression to remove special fields from the diagram; optional

    • fieldClassifierListToIgnore - a list of classifiers which mark fields as to be ignored during the creation of the diagram

    • hideClasses - a string list of all classes which should be hidden in the resultign class diagram; optional

    • hideFields - simple toggle to hide field information in the Plant UML diagram; optional, defaults to false
      adds the "hide fields" command to the Plant UML diagram, but the fields are still part of the diagram text

    • hideMethods - simple toggle to hide method information in the Plant UML diagram; optional, defaults to false
      adds the "hide methods" command to the Plant UML diagram, but the methods are still part of the diagram text

    • maxVisibilityFields - a toggle to remove fields with a special visibility; defaults to PRIVATE; if you set it to

      • PUBLIC - only public fields will be displayed

      • PROTECTED - only public and protected fields will be displayed

      • PACKAGE_PRIVATE - only public, protected and package_private fields will be displayed

      • PRIVATE - all fields will be displayed if not removed or ignored by other parameters

    • maxVisibilityMethods - a toggle to remove methods with a special visibility; defaults to PRIVATE; if you set it to

      • PUBLIC - only public methods will be displayed

      • PROTECTED - only public and protected methods will be displayed

      • PACKAGE_PRIVATE - only public, protected and package_private methods will be displayed

      • PRIVATE - all methods will be displayed if not removed or ignored by other parameters

    • methodBlacklistRegexp - a regular expression to remove special methods from the diagram; optional

    • methodClassifierListToIgnore - a list of classifiers which mark methods as to be ignored during the creation of the diagram

    • outputDirectory - the target folder where the diagram file is written; defaults to target/generated-docs

    • removeFields - simple toggle to remove all field information in the Plant UML diagram; optional, defaults to false
      no field information will be part of the diagram text

    • removeMethods - simple toggle to remove all method information in the Plant UML diagram; optional, defaults to false
      no method information will be part of the diagram text

    • useShortClassNames - simple toggle to shorten all class names in the diagram.

    • useShortClassNamesInFieldsAndMethods - simple toggle to shorten class names only in fields and methods in the diagram.

    • useSmetana - simple toggle to activate smetana as layouting engine instead of GraphViz/Dot.

Since Version 2.4.1 the maven plugin is able to use the original method parameter names if the classes are compiled with parameter information enabled (https://openjdk.org/jeps/118):

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven-compiler-plugin.version}</version>
            <configuration>
                <!-- plugin version < 3.6.2 -->
                <compilerArgument>-parameters</compilerArgument>
                <!-- Or, if you use the plugin version >= 3.6.2 -->
                <parameters>true</parameters>
                <testCompilerArgument>-parameters</testCompilerArgument>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
    </plugins>
</build>