Written by Martin Lehmann, Kristine Schaal and Rüdiger Grammes
Version 0.2
see https://github.com/accso/java9-jigsaw-depvis
DepVis visualizes dependencies of Java 9 Jigsaw modules as defined in Project Jigsaw by [JSR 376] (https://www.jcp.org/en/jsr/detail?id=376) and JEP 261. DepVis produces a GraphViz output file (DOT file) which can be rendered with GraphViz in a separate step.
Result looks like this (in this case all Java 9 system modules (build b162) are visualized with all relationships, limited to modules with prefix "java.*"):
- Requires/Read relationships (currently visualized as a blue arrow)
- requires mandated to
java.base
(dashed blue arrow) - requires transitive (blue arrow)
- requires mandated to
- Exports-To relationships (red)
- Requires transitive transitivity (green arrow)
- If
moda--requires-transitive-->modb
(blue) andmodc--requires-->moda
(blue), then alsomodc--requires-->modb
(green). Note that this is currently limited to 1-transitivity.
- If
- DepVis can be configured, see section below.
- A legend is written in the top left corner. As this unfortunately flips the whole graph, this is done as a separate graph.
- A helper printer tool is also included which prints the relationship to STDOUT.
![Legend] (legend.jpg)
- Clone this repo.
- Install a Java 9 JDK with Jigsaw support. DepVis has been tested with b162 as of March 2017.
- Install GraphViz 2.38.
- If running on Windows, install a bash, like for example Babun
- Edit file
env.sh
to configureJAVA_HOME
andGRAPHVIZ_HOME
(see TODO markers) - Call
clean.sh
,compile.sh
andrun-vis.sh
(orall.sh
for all in one step). - Output is
moduledependencies.dot
andmoduledependencies.png
(and a second file pair...with-legend
).
DepVis can be configured in a configuration properties file (see depvis.properties) as follows:
depvis.includeFilter
- comma-separated Strings
- module names whitelist, all used to be checked with
String.startsWith
- if not set, all modules from system and/or module-path will be used
- example:
java.,jdk.
depvis.excludeFilter
- comma-separated Strings
- module names blacklist, all used to be checked with
String.startsWith
- if not set, all modules from system and/or module-path will be used
- example:
jdk.internal
depvis.useSystemModules
- boolean
- do we want to visualize modules from system (i.e.
java.*
,jdk.*
etc.)?
depvis.useModulePath
- boolean value
- want to visualize modules from a module path
- if so,
depvis.modulePath
needs to be set
depvis.modulePath
- path Strings, separated by system's file separator)
- set a local module path
- example:
/jigsaw/example/mlib
depvis.showRequires
- boolean
- want to visualize requires/reads relationships?
depvis.showRequiresMandated
- boolean
- want to visualize requires/reads mandated relationships?
depvis.showRequiresTransitive
- boolean
- want to visualize requires/reads transitive relationships (1-transitive)?
depvis.showExportsTo
- boolean
- want to visualize exports-to relationships?
depvis.outputFileName
- String
- filename for the DOT output file
- example:
/tmp/moduledependencies.dot
depvis.showLegend
- boolean
- want to visualize a legend plus title and timestamp?
- if so, the graph will be flipped to LR
depvis.diagramTitle
- String
- configure a title for the diagram
No software is ready, ever ;-) So here are some ideas left (any other feedback very welcome!):
- Show requires transitive dependencies with a different line style
- Include n-transitivity for requires-transitive
- Allow filtering of individual relationships (black/white listing)
- Include uses/provides relationships
- Include the module's package names
- Include a module's hash value
- Currently, DepVis only shows modules from the Observable Modules (= module path and system modules). Alternatively allow to show modules from a Configuration.
- Allow to configure colors, edge styles, node styles/shapes etc. via config file from outside (currently one needs to change Java class depvis.GraphVizHelper.java and recompile).
- Adding a GraphViz legend seems only possible with
rankdir=LR
. This settings then flips the whole graph (as it cannot be done in a subgraph only). Any way to get around this? - Write the package name(s) to an exports-to edge
- Layouting: Any text added as label to an edge should be visualized "closely"
- Open Modules as new module type
- usage of "opens" in module-info
- "requires public" in the module-info is now "requires transitive".
Jigsaw examples, see https://github.com/accso/java9-jigsaw-examples : Java 9 Jigsaw modules example suite
Thx to the GraphViz team (http://www.graphviz.org) for this magic tool!
Thx also to Kohsuke Kawaguchi for his graphviz-api at https://github.com/kohsuke/graphviz-api! We have forked his API to https://github.com/MartinLehmann1971/graphviz-api and made a few minor changes (mainly to avoid duplicates of GraphViz Nodes based on their ID).