蚂蚁模式匹配以选择文件不起作用 [英] Ant pattern matching to select file is not working

查看:61
本文介绍了蚂蚁模式匹配以选择文件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<fileset dir="${server.src}" casesensitive="yes">
  <patternset id="non.test.sources">
    <include name="**/test-[0-9-]+.zip"/>
  </patternset>
</fileset>

我正在使用模式匹配来在ant build.xml中仅选择特定文件 但是它没有选择任何文件. 我有一个文件名为test-123453.zip

I am using pattern matching to select only particular file in ant build.xml But its not selecting any file. I have a file with name test-123453.zip

推荐答案

filesetinclude元素期望使用glob模式,而不是正则表达式模式.将其嵌套在patternset中不会更改此功能.

A fileset's include element expects glob patterns, not regex patterns. Nesting it in a patternset doesn't change this functionality.

您可以将filename选择器与regex属性一起使用来完成您要执行的操作:

You can use the filename selector with the regex attribute to accomplish what you're trying to do:

<fileset dir="${server.src}">
    <filename regex="test-[0-9-]+\.zip" />
</fileset>

这篇关于蚂蚁模式匹配以选择文件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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