选择文件的 Ant 模式匹配不起作用

编程入门 行业动态 更新时间:2024-10-12 05:54:27
本文介绍了选择文件的 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

推荐答案

filesetinclude 元素需要 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:关键词]

本文发布于:2023-04-20 09:47:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/980041.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   模式   文件   Ant

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!