I'm looking for a tool to integrate into a maven build that will be capable of enforcing the following rules:

  1. No circular dependency among packages is allowed
  2. No parent package can depend on any sub-package (only vice-versa)
  3. No circular dependencies allowed among branches of the package hierarchy (subsumes rule 1). E.g., if package a.b.c depends on a.d.e.f, then none of a.d, a.d.e, a.d.e.f can depend on a.b (or a.b.c), including transitive dependencies.

The idea is that any subtree of the package hierachy can be considered to be a component, and cycles among componenents will be forbidden.

I looked at JDepend, but it seems it does not have the flexibility to enforce these constraints with its standard configuration parameters. Is there a tool for this, or do I have to write this myself? Is there any tool that would at least help by computing the dependency graph and allow me to add my own plugin to check the graph?

1 Answer 1


I think Jens Schauder's DeGraph does fulfil your needs. It can be used to visualize the dependencies or to write tests that check that your dependencies adhere to some rules.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.