1

I am trying to pull a bunch of classes and packages from a large project and create a separate standalone module out of it. Now when I try to compile these classes, due to dependency on other classes, I end up with very large number of compiled classes which I don't intend to have in the standalone module. e.g. if this is class dependency A -> B -> C -> D. And I compile A, I will end with A.class, B.class, C.class and D.class. I want to break the dependency on class D and refactor the code such that class D doesn't become part of the module. But for this to happen, I would have to know the dependency path(s) for given class A and class D. I tried searching SO but without success so far.

Umesh W
  • 41
  • 5

1 Answers1

1

For future stumble-upons: At least as of IntelliJ 2020.1, you can find the list of classes a class would need (or depend upon), recursively, by:

  1. Right click on the class name
  2. Click Analyze > Dependencies
  3. Choose File .java
  4. You can also specify the depth required

(For finding which classes depend on the class in question, choose Analyze > "Backward Dependencies", instead)

For other cases or alternatives: How do I get a list of Java class dependencies for a main class?

Melvin
  • 351
  • 4
  • 10