DependencyExtractor

Description

Takes a JAR and computes dependencies between packages, classes, and features (methods and attributes). The result is an XML document containing all the dependencies. You can use the various XXXToText and XXXToHTML XSL transformations to render the graph as text or HTML for human reading.

The normal output is the resulting dependency graph, rendered as text.

With the serialize attribute, it serializes the entire dependency graph with Java serialization.

With the xml attribute, it converts the entire dependency graph into an XML document that follows the dependencies DTD.

Parameters

Attribute Description Required
destfile where to write the output. If the file does not exists, it is created. If it already exists, its content is overwritten. Yes
serialize writes the dependency graph as serialized Java objects. At this time, Dependency Finder cannot deserialize a saved graph, so this switch is pretty useless. No
xml writes the dependency graph as an XML document with the dependencies DTD. No
dtdprefix prefix of the DTD URL for the XML output document. Only useful with xml. No
indenttext used for each indentation level in textual and XML output. No
minimize minimizes the dependency graph before outputing it. No
maximize maximizes the dependency graph before outputing it. No

Nested elements

path

Use nested path elements to specify file names of JAR files, Zip files, and .class files for the tool to read. You can also give directory names, the tool will search it for .class files and read them. It is a path-like structures.

Examples

To scan the current directory and its subdirectories for .class files to analyze and save the resulting dependency graph to df.xml:

  <dependencyextractor destfile="df.xml" xml="yes">
    <path>
      <pathelement location="."/>
    </path>
  </dependencyextractor>

To scan DependencyFinder.jar and rt.jar for .class files to analyze and save the resulting dependency graph to df.xml:

  <dependencyextractor destfile="df.xml" xml="yes">
    <path>
      <pathelement location="DependencyFinder.jar"/>
      <pathelement location="rt.jar"/>
    </path>
  </dependencyextractor>

To scan DependencyFinder.jar and rt.jar for .class files to analyze and save the resulting dependency graph to df.xml, after having minimized it:

  <dependencyextractor destfile="df.xml" xml="yes" minimize="yes">
    <path>
      <pathelement location="DependencyFinder.jar"/>
      <pathelement location="rt.jar"/>
    </path>
  </dependencyextractor>

To scan the current directory and its subdirectories for .class files to analyze and save the resulting dependency graph to df.xml, and then convert it to HTML:

  <dependencyextractor destfile="df.xml" xml="yes">
    <path>
      <pathelement location="."/>
    </path>
  </dependencyextractor>
  <xslt style="${dependencyfinder.home}/etc/DependenciesToHTML.xsl"
        in="df.xml"
        out="df.html"/>

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