IntelliJ IDEA 2017.3 Help

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

  1. Open a project that contains Java modules.
    /help/img/idea/2017.3/java_jdk9_modules.png
    Note that IntelliJ IDEA allows only one Java module per one IntelliJ IDEA module.
  2. In the Projects tool window select an item (module/project) for which you want to create a diagram.
  3. Right-click the selected item and from the context menu select Diagram | Show Diagram. Alternatively, open the module-info.java file in the editor and from the context menu select Show Diagram.
  4. 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,

/help/img/idea/2017.3/jre_project_diagram.png
create a diagram for this module.
/help/img/idea/2017.3/jre_diagram.png

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 - /help/img/idea/2017.3/module_in_jigsaw_diagram.png
  • named modules (contain module-info.java) - /help/img/idea/2017.3/libraries_in_jigsaw_diagram_JDKmodule.png
  • automatic modules - /help/img/idea/2017.3/libraries_in_jigsaw_diagram_noJDKmodule.png

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.

/help/img/idea/2017.3/jigsaw_connection_diagram.png

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.
    /help/img/idea/2017.3/jigsaw_diagram_elements.png
  • You can view usages of the diagram element in the project files - select the desired element and press Ctrl+Alt+F7.
    /help/img/idea/2017.3/jigsaw_find_usages.png
Last modified: 11 October 2017

See Also