JDepend

Description

Invokes the JDepend parser.

This parser "traverses a set of Java source file directories and generates design quality metrics for each Java package". It allows to "automatically measure the quality of a design in terms of its extensibility, reusability, and maintainability to effectively manage and control package dependencies."

Source file directories are defined by nested <sourcespath>, see nested elements.

Optionally, you can also set the outputfile name where the output is stored. By default the task writes its report to the standard output.

The task requires at least the JDepend 1.2 version.

Note: whereas the JDepend tool can be customized to exclude some packages, the current jdepend And Task does not have parameters to allow these exclusions. Read JDepend specific documentation for that purpose.

Parameters

Attribute Description Required
outputfile The output file name. If not set, the output is printed on the standard output. No
format The format to write the output in. The default is "text", the alternative is "xml" No
fork Run the tests in a separate VM. No, default is "off"
haltonerror Stop the build process if an error occurs during the jdepend analysis. No, default is "off"
timeout Cancel the operation if it doesn't finish in the given time (measured in milliseconds). (Ignored if fork is disabled.) No
jvm The command used to invoke the Java Virtual Machine, default is 'java'. The command is resolved by java.lang.Runtime.exec(). (Ignored if fork is disabled.) No, default "java"
dir The directory to invoke the VM in. (Ignored if fork is disabled) No
classpathref the classpath to use, given as reference to a PATH defined elsewhere. No

Nested Elements

jdepend supports two nested elements <classpath> and <sourcespath>, that represent PATH like structures.

<sourcespath> is used to define the paths of the source code to analyze.

Examples


<jdepend classpathref="base.path">

    <sourcespath>

        <pathelement location="src"/>

    </sourcespath>

</jdepend>



This invokes JDepend on the src directory, writing the output on the standard output. The classpath is defined using a classpath reference.

<jdepend outputfile="docs/jdepend.xml" fork="yes" format="xml">

    <sourcespath>

        <pathelement location="src"/>

    </sourcespath>

    <classpath>

        <pathelement location="classes"/>

        <pathelement location="lib/jdepend.jar"/>

    </classpath>

</jdepend>



This invokes JDepend in a separate VM on the src and testsrc directories, writing the output to the <docs/jdepend.xml> file in xml format. The classpath is defined using nested elements.

Copyright © 2001-2002 Apache Software Foundation. All rights Reserved.