Where are classpath, path and pathelement documented in Ant version 1.8.0?

Posted by Robert Menteer on Stack Overflow See other posts from Stack Overflow or by Robert Menteer
Published on 2010-03-26T21:19:13Z Indexed on 2010/03/26 21:23 UTC
Read the original article Hit count: 375

Filed under:
|

I'm looking over the documentation that comes with Apache Ant version 1.8.0 and can't find where classpath, path and pathelement are documented. I've found a page that describes path like structures but it doesn't list the valid attributes or nested elements for these. Another thing I can't find in the documentation is a description of the relationships between filelist, fileset, patternset and path and how to convert them back and forth. For instance there has to be an easier way to compile only those classes in one package while removing all class dependencies on the package classes and update documentation.

<!-- Get list of files in which we're interested. -->
<fileset id = "java.source.set"
    dir     = "${src}">
  <include name = "**/Package/*.java" />
</fileset>

<!-- Get a COMMA separated list of classes to compile. -->
<pathconvert property = "java.source.list"
    refid             = "java.source.set"
    pathsep           = ",">
  <globmapper from = "${src}/*.@{src.extent}"
      to           = "*.class" />
</pathconvert>

<!-- Remove ALL dependencies on package classes. -->
<depend srcdir = "${src}"
    destdir    = "${build}"
    includes   = "${java.source.list}"
    closure    = "yes" />

<!-- Get a list of up to date classes. -->
<fileset id = "class.uptodate.set"
    dir     = "${build}">
  <include name = "**/*.class" />
</fileset>

<!-- Get list of source files for up to date classes. -->
<pathconvert property = "java.uptodate.list"
    refid             = "class.uptodate.set"
    pathsep           = ",">
  <globmapper from="${build}/*.class" to="*.java" />
</pathconvert>

<!-- Compile only those classes in package that are not up to date. -->
<javac srcdir    = "${src}"
    destdir      = "${build}"
    classpathref = "compile.classpath"
    includes     = "${java.source.list}"
    excludes     = "${java.uptodate.list}"/>

<!-- Get list of directories of class files for package. --:
<pathconvert property = "class.dir.list"
    refid             = "java.source.set"
    pathsep           = ",">
  <globmapper from = "${src}/*.java"
      to           = "${build}*" />
</pathconvert>

<!-- Convert directory list to path. -->
<path id  = "class.dirs.path">
  <dirset dir  = "${build}"
      includes = "class.dir.list" />
</path>

<!-- Update package documentation. -->
<jdepend outputfile = "${docs}/jdepend-report.txt">
  <classpath refid = "compile.classpath" />
  <classpath location = "${build}" />
  <classespath>
    <path refid = "class.dirs.path" />
  </classespath>
  <exclude name = "java.*"  />
  <exclude name = "javax.*" />
</jdepend>

Notice there's a number of conversions between filesets, paths and comma separated list just to get the proper 'type' required for the different ant tasks. Is there a way to simplify this while still processing the fewest files in a complex directory structure?

© Stack Overflow or respective owner

Related posts about ant

Related posts about build.xml