Search code examples
java-8jdependcyclic-dependency

Cyclic dependency analysis for Java 8 - for use in an automated build


I'll working on a project that is using JDepend to automatically generate a report of cyclic package dependencies as part of our CI build. (I am mainly interested in package level dependencies, so I've been using a cut down version of the XSLT to get a more focused report - otherwise, though, it is vanilla JDepend.)

However we are about to move the project to Java 8 and I have found that JDepend does not work against code compiled with the JDK 1.8 compiler. JDepend no longer seems to be being actively updated.

I'm trying to find a replacement that:

  • Works with JDK 1.8 compiled class and/or jars.
  • Reports cyclic dependencies at the package and/or jar level.
  • Can be automated from Ant (command line executable would do).
  • Produces a report that can be linked from a project home page and opened in a browser (e.g. HTML or plain text output - not a desktop app).
  • Also (preferably) produces - or can be configured/tweaked to produce - a focused report of just the cyclic dependencies (as JDepend can, if you modify the XSLT).

Solution

  • Java 8 includes jdeps.exe in the /bin. Although this doesn't explicitly call out cyclic dependencies it does show all dependencies for a project's packages. It's good enough.