Written by Martin Lehmann, Kristine Schaal and Rüdiger Grammes
Version 0.3
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 181) 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 static (dotted blue arrow)
- requires mandated to
- 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
- Exports-To relationships (red)
- Opens-To relationships (orange)
- 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.
This work has been published under Apache License 2.0. Please refer to file 'LICENSE' for further details.
- Clone this repo.
- Install a Java 9 JDK with Jigsaw support. DepVis has been tested with Java9 build 181 and also with 9.0.1-11 (both on Windows 10, x64)
- 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) - Also edit file
env.sh
to configure the path separator. If run on Windows, use ; (a blackslash quoting a ;). If you run all stuff on *nix, use a colon : . - 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, default is true
- do we want to visualize modules from system (i.e.
java.*
,jdk.*
etc.)?
depvis.useModulePath
- boolean, default is true
- 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, default is true
- want to visualize requires/reads relationships?
depvis.showRequiresMandated
- boolean, default is true
- want to visualize requires/reads mandated relationships?
depvis.showRequiresStatic
- boolean, default is true
- want to visualize requires/reads static relationships?
depvis.showRequiresTransitive
- boolean, default is true
- want to visualize requires/reads transitive relationships (1-transitive)?
depvis.showExports
, only needed for the Printer- boolean, default is true
- want to print exports?
depvis.showExportsTo
- boolean, default is true
- want to visualize exports-to relationships?
depvis.showOpens
, only needed for the Printer- boolean, default is true
- want to print opens?
depvis.showOpensTo
- boolean, default is true
- want to visualize opens-to relationships?
depvis.showUses
- boolean, default is true
- want to print uses?
depvis.showProvided
- boolean, default is true
- want to print provides?
depvis.showContains
, only needed for the Printer- boolean, default is true
- want to print contains, i.e. all concealed packages?
depvis.showMainClass
- boolean, default is true
- want to print the main class?
depvis.prefixWithModuleName
, only needed for the Printer- boolean, default is true
- want to prefix each output line with the module name & version (for easier grep's)?
depvis.outputFileName
, only needed for the Visualizer- String
- filename for the DOT output file
- example:
/tmp/moduledependencies.dot
depvis.showLegend
, only needed for the Visualizer- boolean, default is true
- want to visualize a legend plus title and timestamp?
- if so, the graph will be flipped to LR
depvis.diagramTitle
, only needed for the Visualizer- 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 (currently limited to 1-transitivity)
- Allow filtering of individual relationships (black/white listing)
- 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"
No changes necessary
- Include all requires static (both in printer and visualizer - visualized as in dotted blue arrows, also done in the legend)
- Include all opens (only in the printer, not in the visualizer)
- Include all opens-to (both in printer and visualizer - visualized as in orange arrows, also done in the legend)
- Prints all uses and all provides (only in the printer, not in the visualizer)
- Prints the contains, i.e. concealed packages (only in the printer, not in the visualizer)
- Prints the main class (only in the printer, not in the visualizer)
- Print output can now prefix each output line with the module name, see option
depvis.prefixWithModuleName
- Open Modules are now visualized as octagons
- Migrated to Java 9 final release (181), migrated to Eclipse 4.7.1a
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/mrtnlhmnn/graphviz-api and made a few minor changes (mainly to avoid duplicates of GraphViz Nodes based on their ID).
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.