Note that there are some explanatory texts on larger screens.

plurals
  1. POJava package cycle detection: how do I find the specific classes involved?
    text
    copied!<p>What tool would you recommend to detect <strong>Java package cyclic dependencies</strong>, knowing that the goal is to <em>list explicitly the specific classes involved in the detected 'across-packages cycle'</em>?</p> <p>I know about <a href="http://classycle.sourceforge.net/" rel="nofollow noreferrer">classycle</a> and <a href="http://clarkware.com/software/JDepend.html" rel="nofollow noreferrer">JDepend</a>, but they both fail to list the classes involved in a cyclic package dependency. <a href="http://metrics.sourceforge.net/" rel="nofollow noreferrer">Metrics</a> has an interesting graphical representation of cycles, but it is again limited to packages, and quite difficult to read sometime.</p> <p>I am getting tired to get a:</p> <blockquote> <p><em>" you have a package cycle dependency between those 3 packages</em> <br/> <em>you have xxx classes in each</em> <br/> <em>good luck finding the right classes and break this cycle "</em></p> </blockquote> <p>Do you know any tool that takes the extra step to actually explain to you why the cycle is detected (i.e. 'list the involved classes')?</p> <hr> <p>Riiight... Time to proclaim the results:</p> <p>@l7010.de: Thank you for the effort. I will vote you up (when I will have enough rep), especially for the 'CAP' answer... but CAP is dead in the water and no longer compatible with my Eclipse 3.4. The rest is commercial and I look only for freeware.</p> <p>@daniel6651: Thank you but, as said, freeware only (sorry to not have mentioned it in the first place).</p> <p>@izb as a frequent user of findbugs (using the latest 1.3.5 right now), I am one click away to accept your answer... if you could explain to me what option there is to activate for findbug to detect any cycle. That feature is only mentioned for the <a href="http://findbugs.sourceforge.net/Changes.html" rel="nofollow noreferrer">0.8.7 version in passing</a> (look for '<em>New Style detector to find circular dependencies between classes</em>'), and I am not able to test it. Update: It works now, and I had an old findbugs configuration file in which that option was not activated. I still like <a href="https://stackoverflow.com/questions/62276/java-package-cycle-detection-how-to-find-the-specific-classes-involved#71610">CAD</a> though ;)</p> <p>THE ANSWER is... see <a href="https://stackoverflow.com/questions/62276/java-package-cycle-detection-how-to-find-the-specific-classes-involved#71610">my own (second) answer below</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload