ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject Re: JDepend
Date Sun, 03 Feb 2002 11:41:49 GMT
On Sun, 3 Feb 2002 02:58, Stephane Bailliez wrote:
> ----- Original Message -----
> From: "Peter Donald" <>
> > I have setup a basic jdepend task and report (dependency information
> > about codebase) for the main ant tree. However it turns out that it
> > points out
> more
> > problem areas in the main ant codebase (ie circular dependencies and very
> > very very scattered interactions and so forth) and since we can't change
> it -
> > it doesn't seem to be a good idea of reporting it everyday? Or maybe not
> > - what do you think? Should I commit it or not. It would also mean that
> > we
> need
> > to include jdepend 2.1+ in CVS.
> For now, you could just post the results here with your
> comments/recommendation.
> It's always interesting.

Okay the results are attached to this mail. Unfortunately they are all in one 
html page and I didn't have the patience to make a frames version. Anyone 
else who wants to should feel free to add another frames version of 

Heres my thoughts;

* In an ideal world there would be no dependency cycles however we have 
accumulated a few. 
* Low abstraction packages should depend upon high abstraction packages and 
not the reverse.
* I would also like to see a cap on the number of classes in a package - 
possibly under 15-20 or so to keep complexity level lower.
* dependencies on unstable packages should be avoided if at all possible - 
only depend on stable packages unless there is a damn good reason not to.
* distance should be from the main sequence should be either 0% or 100% - 
nowhere in between.

Anywhow a few people have asked me off list about how to go about doing this. 
To generate the report you need the CVS version of Ant and then you download 
jdepend from and place it in 
project.class.path. Then you run something like the following. Note the 
stylesheet is the one included in ants etc/ directory.

    <jdepend outputfile="build/jdepend.xml" format="xml" fork="yes">
      <classpath refid="project.class.path"/>
          <pathelement location="src/java" />

    <style in="build/jdepend.xml" processor="trax" out="build/jdepend.html" 

However if you wanted more than a report. Specifically if you wanted to do 
things like make sure there is no circular dependencies between packages then 
you are going to have to write a JUnit test case that uses JDepend. An 
example of this can be seen in ants CVS at 




"Therefore it can be said that victorious warriors 
win first, and then go to battle, while defeated 
warriors go to battle first, and then seek to win." 
              - Sun Tzu, the Art Of War

View raw message