嵌套路径和文件集有什么区别?
我已经在谷歌上搜索“文件集和路径之间的差异”文章有一段时间了,但没有发现任何有用的东西。 例如,以下内容(例如,有一个 someDir 目录,其中包含 .jar 文件且没有子目录):
<path id="somePathId">
<pathelement path="someDir"/>
</path>
<path id="someId">
<path refid="somePathId" />
</path>
和 之间
<path id="someId">
<fileset dir="someDir">
<include name="*.*">
</fileset>
</path>
有什么区别?
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>
and
<path id="someId">
<fileset dir="someDir">
<include name="*.*">
</fileset>
</path>
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它们用于不同的情况。
fileset
用于指定一组文件。您可以使用selector
和patternset
来仅获取您想要的文件。classpath
用于指定类路径引用。可以使用单个 jar (location="..."
)、;
或:
指定classpath
分隔的 jar 列表(path="..."
)或嵌套资源集合(如fileset
)。另外,如果你想调试它们,它是不同的:
vs
至于你的脚本,
我没有测试它,而是根据 文档
path=
需要一个;
或:
分隔的 jar 列表。这与您的第二个示例不同。They are used in different situations.
fileset
is used to specify a group of files. You can useselector
s andpatternset
s to get only the files you want.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 (likefileset
).Also if you want to debug them, it is different:
vs
As for your scripts,
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.
和
之间的主要区别在于,在
中,您可以指定是否要包含或排除某些类型的文件(基本上,它是路径中的一组文件......不一定是所有文件),例如:The major difference between a
<path>
and a<fileset>
is that in<fileset>
you can specify if you want to include or exclude certain type of files (Basically, its a group of files within a path... not necessary all the files), for eg: