Coder Social home page Coder Social logo

iluwatar / uml-reverse-mapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nitorcreations/domainreversemapper

220.0 220.0 87.0 2.22 MB

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

License: Apache License 2.0

Java 100.00%
class-diagram graphviz hacktoberfest maven-plugin mermaid plantuml uml uml-diagram uml-diagrams

uml-reverse-mapper's People

Contributors

d4gg4d avatar dependabot-preview[bot] avatar dependabot[bot] avatar hbothra15 avatar iluwatar avatar markusmo3 avatar sivasubramanim avatar vertti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uml-reverse-mapper's Issues

Update README.md instructions

README.md contains some old and misleading information. In this task we fix it so the artifacts become easily discoverable and usable.

Syntax error when generating package private abstract classes

package private abstract classes are generated with the plugin in this manner:

abstract ~class SomeAbstractClass {
...
}

which is a syntax error:
Screenshot Capture - 2022-05-10 - 16-08-36

Normally the '~' sign must be written before abstract like this :

~abstract class SomeAbstractClass {
...
}

Request : showing a config example with a real project (in a video)

Hi,

Currently I'm trying to generate the UML file with mvn clean package for 2 projects :

  • 1 with Spring Boot.
  • 1 with only a main() calling a dummy class.

In both cases I generate a file for graphviz plantuml and mermaid but the content is nearly empty.

Could you please provide us a video showing how to configure correctly your plugin with a project (for example a Spring Boot) ?

Thanks a lot.

Alexandre

Change PlantUML presenter file extension

As described in https://plantuml.com/command-line the PlantUML command line tool only searches files with specific extension from directories. The currently used .puml is not one of them. We should use for example .pu to be compatible with the tool.

Acceptance criteria

  • Output files generated with PlantUML presenter have .pu file extension

Upgrade to Java 11

The project is currently using Java 8 features. In this task we update to Java 11. Travis build should also be set to use openjdk 11.

Few queries

Thanks for developing the application UML Reverse Mapper. I am looking for a similar application.

I have the following queries. I am using the Issues section, as I did not find any other place to raise them. Appreciate a clarification.

  1. I referred to the procedure given in https://java-design-patterns.com/blog/auto-generate-class-diagrams-with-uml-reverse-mapper/ and have generated .uml files. How to open the UML file? Eclipse shows it as an XML file.

  2. The app generates Class diagram as documented. What changes are required to auto-generate Sequence diagrams from Java code?

Add Sonar

Add SonarCloud to get good static code analysis

Use Maven wrapper for builds

To make the build more standardised, let's use Maven wrapper.

Acceptance criteria

  • Maven wrapper is used for the builds
  • Instructions updated
  • CI build updated

consider downgrade the target java version to 8 or 11?

When I run

mvn com.iluwatar.urm:urm-maven-plugin:help -Ddetail=true -Dgoal=map

got

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.041 s
[INFO] Finished at: 2023-09-04T22:28:27+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.iluwatar.urm:urm-maven-plugin:2.1.1:help (default-cli) on project apollo-openapi: Execution default-cli of goal
 com.iluwatar.urm:urm-maven-plugin:2.1.1:help failed: Unable to load the mojo 'help' in the plugin 'com.iluwatar.urm:urm-maven-plugin:2.1.1' due t
o an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com/iluwatar/urm/urm_maven_plugin/HelpMojo 
has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

environment:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Program Files\Apache\apache-maven-3.6.3\bin\..
Java version: 11.0.19, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-11.0.19.7-hotspot
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

In

<target>17</target>

The target compiled .class's java version is 17, could downgrade it to 8 or 11? Because many projects don't use java 17 yet, that will cause this plugin cannot work on those project.

Fix Sonatype Lift findings

Sonatype Lift reports some critical findings. Let's fix them in this issue.

Acceptance criteria

  • Sonatype Lift critical findings have been fixed

Class Diagram not generated by the plugin

It generated a file exchange.urm.dot. It contains

digraph domain {
edge [ fontsize = 11 ];
node [ shape=record ];
}

At the time of build, I am getting this log. Not sure why it is not working.

[INFO] --- urm-maven-plugin:2.0.0:map (default) @ exchange ---
Downloading from central: https://repo.maven.apache.org/maven2/com/iluwatar/urm/urm-core/2.0.0/urm-core-2.0.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/com/iluwatar/urm/urm-core/2.0.0/urm-core-2.0.0.pom (4.6 kB at 3.5 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/iluwatar/urm/urm-core/2.0.0/urm-core-2.0.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/com/iluwatar/urm/urm-core/2.0.0/urm-core-2.0.0.jar (5.0 MB at 2.0 MB/s)
13:56:22,923 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
13:56:22,923 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
13:56:22,923 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/C:/Users/Balachandar.S/.m2/repository/com/iluwatar/urm/urm-core/2.0.0/urm-core-2.0.0.jar!/logback.xml]
13:56:22,933 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@2100669f - URL [jar:file:/C:/Users/Balachandar.S/.m2/repository/com/iluwatar/urm/urm-core/2.0.0/urm-core-2.0.0.jar!/logback.xml] is not of type file
13:56:22,951 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
13:56:22,952 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
13:56:22,957 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
13:56:22,998 |-WARN in ch.qos.logback.core.ConsoleAppender[CONSOLE] - This appender no longer admits a layout as a sub-component, set an encoder instead.
13:56:22,998 |-WARN in ch.qos.logback.core.ConsoleAppender[CONSOLE] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
13:56:22,998 |-WARN in ch.qos.logback.core.ConsoleAppender[CONSOLE] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
13:56:22,999 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.iluwatar.urm] to INFO
13:56:22,999 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.iluwatar.urm] to false
13:56:22,999 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[com.iluwatar.urm]
13:56:23,000 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
13:56:23,000 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[ROOT]
13:56:23,000 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
13:56:23,001 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5db9849d - Registering current configuration as safe fallback point

[INFO] exchange.urm.dot successfully written to: "D:\alkimi\sourcecode\backend-may\alkimi-backend\exchange\etc\exchange.urm.dot"!

Refactor and release

  • update artifact name
  • update package names
  • release current version to Maven Central

Fix build warnings

When executing the build, the output contains a couple of errors/warnings like "some dependencies of Maven Plugins are expected to be in provided scope".

Acceptance criteria

  • The build warnings have been fixed

Run code against multiple java version

As we want to let this URM be used by multiple users hence it would be great to always make sure our plugin is always compatiable with multiple version of java, as of now JDK 8 and JDK 11 should do, once we have JDK 14 as stable release we can also try to run our code against the same

Update dependencies

Due to last release made several years ago, the project dependencies are not up to date anymore. In this issue we upgrade the dependencies to the latest versions. This issue should probably be done before the Java 11 update #18.

Redirect project

  • rename project
  • rename modules
  • rename packages
  • strip unneeded stuff from README.md
  • remove unneeded code

Add ability to parse test classes

I work a lot with test automation and most of the code is located in src/test/java directory (maven structure).
I want to create a class diagram for my testing project (it's pretty big and have more than 300 classes), but I can't use uml-reverse-mapper because it ignores classes in src/test/java and looks only in src/main/java
It would be cool to add some attrubute to look for package not in the /main, but in the /test.

Doesn't work with springboot project

i tried this maven plugin using spring pet client project here :

https://github.com/spring-projects/spring-petclinic

using this config :

<plugin>
   <groupId>com.iluwatar.urm</groupId>
   <artifactId>urm-maven-plugin</artifactId>
   <version>2.0.0</version>
   <configuration>
      <packages>
         <param>org.springframework.samples.petclinic.owner</param>
      </packages>
      <includeMainDirectory>true</includeMainDirectory>
   </configuration>
   <executions>
      <execution>
         <phase>process-classes</phase>
         <goals>
            <goal>map</goal>
         </goals>
      </execution>
   </executions>
</plugin>

uml output is only

@startuml
@enduml

run it with java 11 openjdk. is there any missing config of mine ?

Gradle plugin

Currently we have Maven plugin to execute uml-reverse-mapper as part of the build process. It would be great to be able to support Gradle based builds too.

Add checkstyle

Add Checkstyle with Google style to ensure consistent formatting

plugin does not work on projects without main()

Hi,
Nice work on your plugin!

This plugin does not work for projects which are libs or frameworks only or in short projects which do not have main().

For example I tried with my project: https://github.com/jay-g-mehta/reflectioninvoker
and have this plugin in my pom.xml as :

           <plugin>
                <groupId>com.iluwatar.urm</groupId>
                <artifactId>urm-maven-plugin</artifactId>
                <version>1.4.8</version>
                <configuration>
                    <!-- if outputDirectory is not set explicitly it will default to your build dir -->
                    <outputDirectory>${project.basedir}/etc</outputDirectory>
                    <packages>
                        <param>reflectioninvoker</param>
                    </packages>
                    <includeMainDirectory>true</includeMainDirectory>
                    <includeTestDirectory>false</includeTestDirectory>
                    <presenter>graphviz</presenter>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>map</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

It didn't work.

I created a dummy Main.java as:

package reflectioninvoker;

public class Main {
    public static void main(String args[]) {

    }
}

and this plugin worked.

Update to JUnit 5

The tests have been implemented using JUnit 4 and Hamcrest. In this task, let's update to JUnit 5 and get rid of the Hamcrest dependency, if possible.

Acceptance criteria

  • Upgraded to JUnit 5
  • Hamcrest dependency removed

Generate diagram images automatically

Currently uml-reverse-mapper can automatically create the code for the diagram automatically. The user then has to produce the image of the diagram using other tools. In this task we try to generate also the image automatically after the diagram code.

Add Java 11 support

Currently the project is being built with Java 8. It would be great to upgrade to Java 11. It's easy to set the maven-compiler-version to 11 to compile with newer Java but this breaks the tests and the reason should be investigated.

Create sequence diagrams

In addition to class diagrams it would be awesome to support sequence diagrams. After some research, it seems that all of the current presenters support that diagram type, so it should be possible. Here are the examples for each presenter.

Graphviz:

digraph G {
 rankdir="LR";
 node[shape="point"];
 edge[arrowhead="none"]

 {
   rank="same";
   LC[shape="plaintext"]
   LC -> step00 -> step01 -> step02 -> step03 -> step04 -> step05;
 }

 {
   rank="same";
   Agency[shape="plaintext"]
   Agency -> step10 -> step11 -> step12 -> step13 -> step14 -> step15;
 }

 {
   rank="same";
   Agent[shape="plaintext"]
   Agent -> step20 -> step21 -> step22 -> step23 -> step24 -> step25;
 }

 step00 -> step10 [label="sends email new custumer", arrowhead="normal"];
 step11 -> step01 [label="declines", arrowhead="normal"];
 step12 -> step02 [label="accepts", arrowhead="normal"];
 step13 -> step23 [label="forward to", arrowhead="normal"];
 step24 -> step14;
 step14 -> step04 [arrowhead="normal"];
}

PlantUML:

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml

Mermaid:

sequenceDiagram
	Alice->>+John: Hello John, how are you?
	Alice->>+John: John, can you hear me?
	John-->>-Alice: Hi Alice, I can hear you!
	John-->>-Alice: I feel great!

PlantUML presenter

Currently uml-reverse-mapper can generate GraphViz compatible output. Another presenter should be added that can generate PlantUML format.

Objectives:

  • uml-reverse-mapper can generate PlantUML compatible output
  • the presenter to be used can be configured with options

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.