5

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).
Paul
  • 3,009
  • 16
  • 33
  • 1
    Okay, so... I completely missed the fact that this - https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jdeps.html - exists in the JDK 1.8 tool set. (Just trying it now.) – Paul May 15 '15 at 13:56
  • would love a tool for maven that could also fail the build... – xenoterracide May 19 '15 at 13:23
  • Yes, I like a simple tool to fail the build (or maybe a unit test) if there are any cyclic dependencies between packages and/or jars, too. – Paul May 20 '15 at 09:41
  • You might be able to write a unit test that compares the current output of jdeps.exe to some earlier version that represented acceptable dependencies. If the dependencies change the test will fail - at which point you either fix the dependencies or update the test to reflect that the new dependencies are still acceptable. (Bit of a hack, but...) – Paul May 20 '15 at 09:42

1 Answers1

3

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.

Paul
  • 3,009
  • 16
  • 33