Working with Java module dependency diagrams
IntelliJ IDEA lets you view and manage diagrams for Java modules that are part of the Jigsaw project, which comes with JDK 9, so make sure you have the latest JDK 9 Early Access build installed to view and manage such diagrams.
Viewing a Java module diagram
- Open a project that contains Java modules. Note that IntelliJ IDEA allows only one Java module per one IntelliJ IDEA module.
- In the Projects tool window select an item (module/project) for which you want to create a diagram.
- Right-click the selected item and from the context menu select
module-info.java
file in the editor and from the context menu select . . Alternatively, open the - From the list that opens, select the Java Module Diagram type. IntelliJ IDEA displays a diagram with modules and its dependencies.
You can also select a JDK module and using the context menu or pressing Ctrl+Shift+Alt+U, create a diagram for this module.
Analyzing a Java module diagram
IntelliJ IDEA lets you view and analyze modules and its dependencies (named and automatic modules). You can easily recognize those modules since they each have a different color.
- IntelliJ IDEA modules -
- named modules (contain
module-info.java
) - - automatic modules -
A connection between modules and dependencies is shown using arrows. With bold arrows IntelliJ IDEA displays a connection between modules and transitive dependencies. So you can always see what gets pulled in with the module.
Managing a Java module diagram
IntelliJ IDEA lets you manage your diagram performing basic diagram actions such as jumping to the source code, find usages, etc.
For more information, please see Diagram Reference, but check the following useful actions:
- You can jump to the source code - select the desired item and press F4
- You can quickly locate a module or a library if you have too many items in your graph - press Ctrl+F and from the list that opens, select the element you're looking for.
- You can view usages of the diagram element in the project files - select the desired element and press Ctrl+Alt+F7.