如何根据目录内容从 ant 文件集中排除目录 [英] How to exclude a directory from ant fileset, based on directories contents

查看:27
本文介绍了如何根据目录内容从 ant 文件集中排除目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个基于目录内容排除某些目录的 ant 文件集?

How can I create an ant fileset which excludes certain directories based on the contents of the directory?

我使用 ant 创建了一个分发 jar,它在单独的目录中具有每个本地化,其中一些不完整,不应发布.

I use ant to create a distribution jar which has each localization in separate directories, some of which are incomplete and should not be released.

我想向目录中添加一些内容(例如名为 incomplete.flag 的文件),以便 ant 排除该目录.然后我可以在翻译完成后删除该文件,并在不修改 build.xml 的情况下将其包含在构建中.

I would like to add something to the directory (for example a file named incomplete.flag) so that ant excludes the directory. Then I can delete the file when translation is complete, and include it in the build without modifying build.xml.

鉴于此目录结构:

proj
+ locale
  + de-DE
  + en-US
  + fr-FR

这个文件集排除了所有 incompelte.flag 文件,但我如何排除包含它们的整个目录?

This fileset excludes all incompelte.flag files, but how can I exclude the entire directories that contain them?

  <fileset dir="${basedir}">
    <include name="locale/"/>
    <exclude name="locale/*/incomplete.flag">
  </fileset>

如果需要,我可以编写一个 ant 任务,但我希望 fileset 可以处理这个用例.

I can write an ant task if need be, but I'm hoping the fileset can handle this use case.

推荐答案

以下方法对我有用:

<exclude name="**/dir_name_to_exclude/**" />

这篇关于如何根据目录内容从 ant 文件集中排除目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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