嵌套路径和文件集有什么区别? [英] What's the difference between a nested path and fileset?

查看:28
本文介绍了嵌套路径和文件集有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在谷歌上搜索文件集和路径之间的差异"一文,但没有发现任何有用的东西.例如,以下有什么区别(比如说,有一个 someDir 目录,其中包含 .jar 文件并且没有子目录):

I have been googling for the "Differences between fileset and path" article for some time, but have found nothing useful. For example, what is the difference between the following (say, there is a someDir directory, which contains .jar files and has no subdirectories):

<path id="somePathId">
    <pathelement path="someDir"/>
</path>

<path id="someId">
  <path refid="somePathId" />
</path>

<path id="someId">
  <fileset dir="someDir">
     <include name="*.*">
  </fileset>
</path>

?

推荐答案

它们在不同的情况下使用.

They are used in different situations.

fileset 用于指定一组文件.您可以使用 selectors 和 patternsets 来只获取您想要的文件.

fileset is used to specify a group of files. You can use selectors and patternsets to get only the files you want.

classpath 用于指定类路径引用.classpath 可以用单个 jar (location="...")、;: 指定jar 的分隔列表(path="...")或嵌套的资源集合(如 fileset).

classpath is used to specify classpath references. classpath can be specified with a single jar (location="..."), a ; or : separated list of jars (path="...") or with nested resource collections (like fileset).

另外,如果你想调试它们,那就不同了:

Also if you want to debug them, it is different:

<echo message="Build-path: ${toString:build-path}" />

对比

<property name="debug.classpath" refid="classpath"/>
<echo message="Classpath = ${debug.classpath}"/>

至于你的脚本,

<path id="somePathId">
    <pathelement location="someDir"/>
</path>

我没有测试它,但根据 documentation path= 需要 ;: 分隔的 jar 列表.这与您的第二个示例不同.

I did not test it but according to the documentation path= expects a ; or : separated list of jars. This is not the same as your second example.

这篇关于嵌套路径和文件集有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆