Monday, December 8, 2014

Maven: Dependency Visualization

Add this to any POM:

 <build>  
      ...  
      <plugins>  
           <plugin>  
                <groupId>org.apache.maven.plugins</groupId>  
                <artifactId>maven-dependency-plugin</artifactId>  
                <version>2.2</version>  
           </plugin>  
           ...  
      </plugins>  
 </build>  


Run this command on the Maven Command Line:

mvn dependency:tree -DoutputType=graphml -DoutputFile=..\docs\swtk.core.web.tomcat-1.0.0.graphml

The red bold text should be substituted as appropriate.

Opening the file in yEd


Download and install yEd.

The generated file can be opened in yEd. Initially, the generated dependencies will be unstructured, and look something like this:


For automatic restructuring with yEd, I recommend the radial layout:
Layout > Radial
I tend to use the following options:


I prefer the Radial technique over the simple hierarchical algorithm for the clustering intelligence built into this layout algorithm.

It's a lot easier to see where key dependencies are introduced.

1 comment: