|
|
Using Hairball
Download the latest version and unzip it.
The supported arguments are:
-includePackages A comma seperated list of packages to include
in analysis, e.g. java.lang,java.util
-output The file to output to
-analysis The type of analsis to run. 'constructorInjection',
'setterInjection' and 'all' are supported. Defaults to 'all'
-classJar The class jar to analyse
-format The format to use. 'dot' and 'graphml' are supported.
Defaults to dotFor example, to create a Dot graph only showing classes in com.mycompany:
java -jar hairball_<version>.jar -classJar myclasses.jar -output graph.dot -includePackages com.mycompany
To create diagrams from dot files, use Graphviz; for graphml files simply open them with [http://www.yworks.com/en/products_yed_about.htm yEd].
Viewing with GraphViz
The Dot command line program provided with graphviz supports a lot of command line options, but it to get you started, this will produce a PNG format diagram:
dot -Tpng -O somefile.dot
Note that for very large diagrams, Dot can fail - as can some programs when it comes to actually viewing the pictures themselves. If this happens try using GraphML & yEd instead.
Viewing with yEd
Hairball isn't capable of automatically laying out diagrams - the GraphML output needs to be laid out by yEd after you load it. Some layouts work better than others (it depends on the codebase) but I find Circular to be quite useful.
Sign in to add a comment
