How to Generate a Sequence Diagram from Java Source Code
Asked Answered
S

9

46

I have a question about generating sequence diagram from Java source code. When I googled I saw someone told to use visual paradigm (VP), but it does not generate sequence diagram for me. Some steps in my VP are different from manual. The manual says to choose method but my VP does not allow to select method in a special class. Reverse Engineering Sequence Diagram from Java Source Code

Does anyone have a new idea to generate sequence diagram from Java source code?

Signpost answered 26/6, 2013 at 4:55 Comment(2)
Are you sure you want to obey your strange VP which does not allow to select method? What is the starting point then?Fare
only choose the class !!!Signpost
M
50

With Intellij 2019 there are two plugins can do this job:

  1. SequenceDiagram (currently 1.3). Go in your in Class method that you want to analyse and Tool>SequenceDiagram : enter image description here

  2. ZenUML support (currently 2019.1.2) enter image description here

Marquismarquisate answered 27/4, 2016 at 12:52 Comment(3)
It works amazingly. Highly recommended to try! Also works in Android Studio 2.0Kieserite
Excellent tool. Thank you so much for suggesting it.Brecciate
SequenceDiagram 1.3 works amazingly well with Intellij 2019.1.3 . Awesome!Ette
M
8

If you are using or wish to use the Eclipse IDE then you can install the ObjectAid UML plugin that can reverse engineer from:

  • Java Stack Trace Console
  • Java Stack Frames from Debug View
  • Methods Call from Call Hierarchy View

and MUCH more.

See http://www.objectaid.com/sequence-diagram

Maxie answered 20/8, 2014 at 2:16 Comment(0)
W
6

I have implemented a junit test based sequence generator which generates sequence diagrams for the pgf-umlsd latex package example: Generated sequence diagram

Hello world

@Test
@SequenceDiagram({ Controller.class, Model.class })
public void testMethod() {
    Controller c = new Controller(new Model());
    c.init();
    c.simpleBeanOperation();
}

https://github.com/sherif181/java-sequence-diagram-generator

Wakeen answered 2/12, 2014 at 16:1 Comment(3)
Looks interesting. Unable to setup and use it yet. An installation and usage document would have helped.Katrinka
The SDTEST folder contains a working example. You will also need a way to compile latex files like ie miktex on windows or texlive on real operating systemsWakeen
I agree with @supernova. I am not familiar with what you are doing in that project and could use some instruction in the readme in the way of gradle commands and requirements on how to generate the diagrams... might be a cool project, but without documentation to get started I am lost and look elsewhere.Malaspina
S
1

UML-VP could generate sequence diagrams, pretty well. Based on your description, I feel you chose the package directory for presenting the source files to the tool. I have faced similar problem. The solution is to choose the "src" folder above the package folder, and then you can see some pretty nice diagrams flying out. Good Luck.

Showman answered 8/2, 2014 at 8:51 Comment(0)
N
1

try this tool, This tool helps you to create the Java source code to Sequence and class diagram, including the execution time of each flow.

follow the steps as given in the documentation

http://maintainj.com/

Nelda answered 12/5, 2014 at 8:50 Comment(1)
the evaluation license, you can use the product without any restrictions for 7 days.Preconception
S
1

Another good tool that generates sequence diagrams from Java programs is JIVE: www.cse.buffalo.edu/jive

It is available as a plug-in for Eclipse and is a free download. Also supports visualization of multi-threaded Java programs.

Note: JIVE generates the diagram for the execution of the program. It also generates object diagrams, and has other useful features such as query-based debugging. Sorry if this is not what you had in mind.

Softwood answered 16/5, 2015 at 15:41 Comment(4)
JIVE works for small programs. It hangs on bigger programs, for example if I use PowerMock in my JUnit test.Threnode
Did you try using JIVE's Exclusion Filters to suppress the visualization of packages that you don't want to see? This can be done from the Run menu: Run -> Debug Configurations -> JIVE tab. As you can see, JIVE comes pre-loaded with certain packages to be excluded, but when you work with a big application, this is often necessary to prevent hanging and keep the visualization manageable.Softwood
Yes, I excluded all PowerMock packages.Threnode
Please see cse.buffalo.edu/jive/tutorials/managing_jive.html for managing large runs. You might try debugging over an interval, if this is applicable to your situation. Or perhaps you need to suppress more packages from being visualized. Just some suggestions.Softwood
S
1

I tried a lot of options today to generate Sequence and class diagrams from my existing code using IntelliJ Idea community edition, Below is the Solution which worked for me finally:

Specific versions of Intellij community edition only was compatible with the required plugins to make this work.

so its very important to download the right versions of IDE and plugins to make it work.

Here are the links to the complete set of softwares with specific versions which worked for me, pls note i tested these on my Mac Book Pro:

  1. [IntelliJ Community Edition IDE]
  2. Code Iris for creating class diagrams and visualizing the code

  3. SequenceDiagram Plugin for generating Seq Diagram on IntelliJ IDE.

Shigella answered 3/8, 2016 at 4:49 Comment(0)
S
0

There are many products that can generate sequence diagrams from Java source code. Unfortunately, all of the good ones cost a lot of money.

If you are using the community edition of Visual Paradigm, it does not allow you to generate any diagrams. You must upgrade to one of the paid versions.

You can compare the paid vs the free edition here
http://www.visual-paradigm.com/product/vpuml/features/?edition=ce

You need to buy standard edition of Visual Paradigm that support Code engineering.

Check out some of these links for alternative programs which also can generate diagrams / source code.

Posiden UML http://www.gentleware.com

Argo UML http://argouml.tigris.org


Other Resources

How can I generate sequence diagrams from Java source code?

Sequence Diagram Reverse Engineering

http://www.altova.com/umodel/sequence-diagrams.html

Senate answered 23/7, 2013 at 23:29 Comment(0)
P
0

The unable to select operation when performing reverse engineering of Java source code to sequence diagram in VP probably caused by selecting the wrong source folder. As long as you select the root folder of your source (according to the "package" statement of your class) it should then works. BTW, Visual Paradigm offer the subscription license which allow user to subscribe the license in monthly basis and in a relative low cost.

Psychosomatic answered 20/9, 2016 at 8:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.