Ant版本1.8.0中记录了classpath,path和pathelement的位置?

Rob*_*eer 44 ant build.xml

我正在查看Apache Ant版本1.8.0附带的文档,但无法找到记录类路径,路径和元素的位置.我找到了一个描述类似结构的路径的页面,但它没有列出这些的有效属性或嵌套元素.我在文档中找不到的另一件事是描述filelist,fileset,patternset和path之间的关系以及如何来回转换它们.例如,必须有一种更简单的方法来编译一个包中的那些类,同时删除包类和更新文档上的所有类依赖项.

<!-- 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>
Run Code Online (Sandbox Code Playgroud)

请注意,文件集,路径和逗号分隔列表之间存在大量转换,只是为了获得不同ant任务所需的正确"类型".有没有办法简化这个,同时仍然处理复杂目录结构中最少的文件?

Cri*_*spy 11

这是我能找到的关于classpath文档的最接近的文件.

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

  • 是的,我发现了,但它没有详细说明.具体而言,它没有说明哪些属性或嵌套元素有效. (7认同)
  • ANT doco专注于任务.您通过渗透学习的其他部分:-)例如,参考文献花了我很长时间才弄明白(http://ant.apache.org/manual/using.html#references) (2认同)
  • 所以这是一个非常无益的答案。除了链接到实际上没有解决方案的文档之外别无他法。 (2认同)