Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
297 views
in Technique[技术] by (71.8m points)

build.xml - Where are classpath, path and pathelement documented in Ant version 1.8.0?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is the closest I could find to documentation on classpath.

http://ant.apache.org/manual/using.html#path


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...