本文介绍了选择文件的 Ant 模式匹配不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
限时送ChatGPT账号..<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
推荐答案
fileset
的 include
元素需要 glob 模式,而不是正则表达式模式.将其嵌套在 patternset
中不会改变此功能.
A fileset
's include
element expects glob patterns, not regex patterns. Nesting it in a patternset
doesn't change this functionality.
您可以使用带有 regex
属性的 filename
选择器来完成您要执行的操作:
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>
这篇关于选择文件的 Ant 模式匹配不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论