Definitions

Dependency Finder defines a number of tasks for use with the Ant build tool from the Apache Foundation. You need to tell Ant where to find the classes that implement these tasks and their support classes. The tasks need the following elements on the CLASSPATH from the Dependency Finder distribution:

In your buildfile

One easy to do this is to define a global <path> tag as part of the Ant project.

    <path id="dependencyfinder">
        <pathelement location="${dependencyfinder.home}/lib/DependencyFinder.jar"/>
        <pathelement location="${dependencyfinder.home}/lib/jakarta-oro.jar"/>
        <pathelement location="${dependencyfinder.home}/lib/log4j.jar"/>
        <pathelement location="${dependencyfinder.home}/classes"/>
    </path>

You can then use this path-like structures to define the tasks, based on the classes supplied by Dependency Finder.

    <taskdef name="classmetrics" classname="com.jeantessier.dependencyfinder.ant.ClassMetrics">
        <classpath refid="dependencyfinder"/>
    </taskdef>
    
    <taskdef name="dependencyextractor" classname="com.jeantessier.dependencyfinder.ant.DependencyExtractor">
        <classpath refid="dependencyfinder"/>
    </taskdef>
    
    <taskdef name="dependencyreporter" classname="com.jeantessier.dependencyfinder.ant.DependencyReporter">
        <classpath refid="dependencyfinder"/>
    </taskdef>
    
    <taskdef name="dependencyclosure" classname="com.jeantessier.dependencyfinder.ant.DependencyClosure">
        <classpath refid="dependencyfinder"/>
    </taskdef>
    
    <taskdef name="dependencymetrics" classname="com.jeantessier.dependencyfinder.ant.DependencyMetrics">
        <classpath refid="dependencyfinder"/>
    </taskdef>
    
    <taskdef name="oometrics" classname="com.jeantessier.dependencyfinder.ant.OOMetrics">
        <classpath refid="dependencyfinder"/>
    </taskdef>
    
    <taskdef name="jarjardiff" classname="com.jeantessier.dependencyfinder.ant.JarJarDiff">
        <classpath refid="dependencyfinder"/>
    </taskdef>
    
    <taskdef name="listdiff" classname="com.jeantessier.dependencyfinder.ant.ListDiff">
        <classpath refid="dependencyfinder"/>
    </taskdef>

With properties file

Another way is to put the path elements on your CLASSPATH and add the task definitions to a properties file. Ant can read the file and do the <taskdef> tags implicitly.

For example, given the following DependencyFinderTasks.properties file:

    classmetrics=com.jeantessier.dependencyfinder.ant.ClassMetrics
    dependencyextractor=com.jeantessier.dependencyfinder.ant.DependencyExtractor
    dependencyreporter=com.jeantessier.dependencyfinder.ant.DependencyReporter
    dependencyclosure=com.jeantessier.dependencyfinder.ant.DependencyClosure
    dependencymetrics=com.jeantessier.dependencyfinder.ant.DependencyMetrics
    oometrics=com.jeantessier.dependencyfinder.ant.OOMetrics
    jarjardiff=com.jeantessier.dependencyfinder.ant.JarJarDiff
    listdiff=com.jeantessier.dependencyfinder.ant.ListDiff

You can use the following in your buildfile:

    <taskdef file="DependencyFinderTasks.properties"/>

Copyright © 2001-2003 Jean Tessier. All rights reserved.