Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Automatically generate class diagram from code. Supports Graphviz, PlantUML and Mermaid output formats.

License

NotificationsYou must be signed in to change notification settings

iluwatar/uml-reverse-mapper

 
 

Repository files navigation

Build StatusMaven CentralJoin the chat at https://gitter.im/iluwatar/uml-reverse-mapper

UML Reverse Mapper

Automatically generate class diagram from your code.

Using reflection, UML Reverse Mapper scans your packages that contain your code. It builds the class relations and can output as aGraphviz .dot file, aPlantUML .puml file or aMermaid .mmd file.

The tool is available in command line version (urm-core) and Maven plugin (urm-maven-plugin).

Using from the command-line

Build theurm-core project with./mvnw clean package and grab the generated artifacturm-core.jar. Then you need the archive that will be analyzed. In this example we useabstract-factory.jar and assume the package name to becom.iluwatar.abstractfactory. Place the jar-files in the same directory and execute the following command.

java -cp abstract-factory.jar:urm-core.jar com.iluwatar.urm.DomainMapperCli -p com.iluwatar.abstractfactory -i com.iluwatar.abstractfactory.Castle

This will scan all the classes under the packagecom.iluwatar.abstractfactory exceptCastle that was marked to be ignored and output the markup to your console output. By default PlantUML presenter is used, but it can be changed with switch-s graphviz or-s mermaid. If you want to write it to file use switch-f filename. If you need to scan multiple packages use format-p "com.package1, com.package2". Note that under Windows OS the classpath separator is; instead of:

Using the Maven plugin

Add to your pom.xml the following:

<build>  <plugins>    <plugin>      <groupId>com.iluwatar.urm</groupId>      <artifactId>urm-maven-plugin</artifactId>      <version>2.1.1</version>      <configuration><!-- if outputDirectory is not set explicitly it will default to your build dir-->        <outputDirectory>${project.basedir}/etc</outputDirectory>        <packages>          <param>com.mycompany.mypackage</param>          <param>com.mycompany.other_package</param>        </packages>        <ignores>          <param>com.mycompany.mypackage.MyClass</param>          <param>com.mycompany.other_package.OtherClass</param>        </ignores>        <includeMainDirectory>true</includeMainDirectory>        <includeTestDirectory>false</includeTestDirectory>        <presenter>graphviz</presenter>      </configuration>      <executions>        <execution>          <phase>process-classes</phase>          <goals>            <goal>map</goal>          </goals>        </execution>      </executions>      <dependencies>        <dependency>          <groupId>com.example</groupId>          <artifactId>example</artifactId>          <version>1.0.0</version>        </dependency>      </dependencies>    </plugin>  </plugins></build>
  • packages configuration parameter contains a list of packages that should be included in the classdiagram
  • ignores configuration parameter contains a list of types that should be excluded from the classdiagram
  • dependencies list should contain the artifacts where the classes are found. Seehttps://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_dependencies_Tag
  • includeMainDirectory configuration parameter indicates to include classes of src/main/javadirectory. Default value ofincludeMainDirectory is true.
  • includeTestDirectory configuration parameter indicates to include classes of src/test/javadirectory. Default value ofincludeTestDirectory configuration parameter is false.
  • presenter parameter control which presenter is used. Can begraphviz,plantuml ormermaid.

Whenprocess-classes life-cycle phase gets executed, the class diagram will be saved to the location specified byoutputDirectory parameter. If not specified the file is savedto/target/${project.name}.urm.<ext>, where is one ofdot (graphiv),puml (plantuml), ormmd (mermaid). Use this file with your localor online tools to show your class diagram.

Showcases

Here are some class diagrams generated with theurm-maven-plugin.

Graphviz examplePlantUML exampleMermaid example

Deploy Instructions

Performing a Release Deployment

export GPG_TTY=$(tty)./mvnw clean deploy -P release

About

Automatically generate class diagram from code. Supports Graphviz, PlantUML and Mermaid output formats.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    Languages

    • Java100.0%

    [8]ページ先頭

    ©2009-2025 Movatter.jp