Search code examples
javaant-contribjdepend

Need a Java Package Dependancy Analysis Tools


Is there anyway to run a package dependency analysis using jDepend, ant contrib's verifydesign task, or any other similar tool, which uses blacklists instead of whitelists?

That is to say, I want to be far less strict (at least initially). Instead of specifying package A must only depend on B, C and K; package B must only depend on Q, W and R; etc. for every package in the system, I'd like to begin by saying: package A absolutely can't have any contact with W and Y, and anything else it does is alright by me. I could then gradually add in the full list of expected dependencies (A depends on only B, C, K) for each package over time, as things are refactored.

So does a tool exist to do this?


Solution

  • You can do this with Structure101 Architecture Diagrams since the diagrams can contain a subset of your codebase. In your example, you could create 3 cells in the diagram for A, W and Y, placing W and Y above A in the diagram (dependencies can only flow downwards, or at least an upward dependency is considered a "violation" of the diagram). Placing W and Y side-by-side above A says that there should be no dependencies between W and Y. If you don't want to restrict dependencies between W and Y (yet), you can merge them into a single cell and inter-dependencies will not be checked. The rules are automatically checked and you can generate warnings and/or errors (break the build if you want). And you can gradually add to the diagram as your refactoring effort progresses...