July 5, 2012 Leave a comment
Came across an extremely poorly coded Java module having 0% KT or documentation in my current engagement. There has been no test cases to begin with, really difficulty to even understand where to start.
“Why not try reverse engineering”, a quick idea, and things started getting fair. 🙂
Here is quick way (maven builds) to get class diagrams generated along with java docs:
1. Download and Install Graphviz from http://www.graphviz.org/Download.php/
2. Add GRAPHVIZ_HOME environment variable.
3. Add following plugin to your maven POM:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.8.1</version> <configuration> <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> <docletArtifact> <groupId>org.umlgraph</groupId> <artifactId>doclet</artifactId> <version>5.1</version> </docletArtifact> <additionalparam>-views</additionalparam> <useStandardDocletOptions>true</useStandardDocletOptions> </configuration> </plugin>
Detailed list of additional params can be found at http://www.umlgraph.org/doc/cd-opt.html, customize it based on your need.
4. mvn javadoc:javadoc will get the docs and class diagrams generated.
Continue exploring more and keep posted.