What are some tools to visualize the dependency hierarchy in Java modules?
Asked by
!leave it there
With the introduction of module import declarations in JEP 511, I've been using module imports a lot more. They're incredibly handy! However, I sometimes wish to see the overall structure of different Java modules. For instance, while `java.desktop` and `java.compiler` are completely distinct, they both rely on `java.base`. On the other hand, `java.se` encompasses both of these modules. While I can look at the modules individually, it would be great to have a centralized tool or view that displays the entire module hierarchy at once. A graphical representation would be ideal, but I'm open to any solution that provides a complete view rather than the piecemeal information from the Javadocs.
Answers
If youโre using Gradle, thereโs a built-in task that can help you view project dependencies. You can check out the [Gradle documentation](https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html) for more details.
Reply to this answer
IntelliJ IDEA has a feature that generates dependency diagrams on-the-fly. I remember seeing a colleague use it, and it showed a nice visual representation of module dependencies.
Reply to this answer
You can easily find what you need by searching online. There are tutorials out there that explain how to visualize the hierarchy and even images of the full structure. Plus, there's a tool called Jdeps that can generate a DOT file, which you can then use with Graphviz for a graphical view.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions