Skip to content →

Generating UML diagram from Java source code

Sometimes we may need to generate UML diagrams from source codes. Here’s what I do for Java code: graphviz + ant + UMLGraph. Details below:

1. Install graphviz and ant, download UMLGraph from http://www.umlgraph.org/

2. Place UMLGraph.jar in your project, for example, under
lib/

3. Write or modify your ant script, for example:


   
   The specification for the Java-based umlgraph build processes.

 
   
   
   
   
   
   
   
 
   
       
       
       
       
       
       
  
 
   
       
           
               
               
                   
               
          
           
       
   
 
   
       
           
               
               
                
               
               
               
               
               
               
               
          
       
  
 

4. Run this ant script.

ant javadocs

5. You will get the UML class diagram as expected in the generated Java docs. Here’s one example (click to enlarge):

com.andryy.hccdroid

Published in Miscellaneous

Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.