Generate UML diagrams for Java from source

ywroks has very good docklet for generating automated UML diagrams from java source code

Here are steps to use it.

I am using maven based system , although you can use ant also. Read the documentation on yworks website. On linux based system you need x server running for uml generation.

Step 1

Download docklet jars

http://www.yworks.com/en/downloads.html#yDoc

Extract it to some location say

D:\Development\yworks-uml-doclet-3.0_01-jdk1.5

 

Step 2

Tell maven you want to use this docklet

Add following to your pom.xml

Add property for path

Add build details for javadoc

<project>…..

<properties>
        <yworks.uml.path>D:\Development\yworks-uml-doclet-3.0_01-jdk1.5</yworks.uml.path>
</properties>

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <!-- Doclet -->
                    <doclet>ydoc.doclets.YStandard</doclet>
                    <docletPath>${yworks.uml.path}/lib/ydoc.jar:${yworks.uml.path}/lib/ydoc.jar:${yworks.uml.path}/resources:${yworks.uml.path}/lib</docletPath>
                    <additionalparam>-umlautogen</additionalparam>
                    <!-- bootclasspath required by Sun's JVM -->
                    <bootclasspath>${sun.boot.class.path}</bootclasspath>
                    <!-- General Javadoc settings -->
                    <doctitle>${project.name} (${project.version})</doctitle>
                    <show>private</show>

                    <docfilessubdirs>true</docfilessubdirs>
                    <!-- Apple's JVM sometimes requires more memory -->
                    <additionalJOption>-J-Xmx1024m</additionalJOption>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>

 

</project>

 

Step 3

Let the magic began

 

mvn:package javadoc:aggregate

or just

mvn javadoc:javadoc

 

Open the javadocs at

/target/site/apidocs/index.html

You can see magical pictures there :)

 

Credit : http://blog.keyboardplaying.org/2012/05/29/javadoc-uml-diagrams-maven/

 

Tip 1: If you want to generate uml for only specific packages use following additional configuration above

<sourcepath>${basedir}/src/main/java/com/MypakagePath</sourcepath>

 


Want to have more fun ?


Read here


http://code.google.com/p/apiviz/#Sample


http://www.umlgraph.org/download.html

No comments:

Post a Comment

Please share your views and comments below.

Thank You.