java left logo
java middle logo
java right logo
 

Home arrow Other API Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 3936
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use JDepend task E-mail
User Rating: / 4
PoorBest 

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>; Class file directories are defined by nested <classesespath>, 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.

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
includeruntime Implicitly add the classes required to run jdepend in forked mode. (Ignored if fork is disabled). Since ant 1.6. No, default is "no".
classpathref the classpath to use, given as reference to a PATH defined elsewhere. No

Nested Elements

jdepend supports four nested elements: <classpath>, <classespath> and <sourcespath>, that represent PATH like structures, and <exclude>.

<sourcespath> is used to define the paths of the source code to analyze, but it is deprecated. With version 2.5 of JDepend, only class files are analyzed. The nested element <classespath> replaces <sourcespath> and is used to define the paths of compiled class code to analyze; the <sourcespath> variable is still available in case you are using an earlier version of JDepend. The <exclude> element can be used to set packages to ignore (requires JDepend 2.5 or above).

Examples

<jdepend classpathref="base.path">
    <classespath>
        <pathelement location="build"/>

    </classespath>
</jdepend>

This invokes JDepend on the build 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.

<jdepend classpathref="base.path">
    <exclude name="java.*>
    <exclude name="javax.*>
    <classespath>

        <pathelement location="build"/>
    </classespath>
</jdepend>

This invokes JDepend with the build directory as the base for class files to analyze, and will ignore all classes in the java.* and javax.* packages.

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.