Ant pattern matching to select file is not working

99封情书 提交于 2019-12-11 11:00:01

问题


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

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


回答1:


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

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>


来源:https://stackoverflow.com/questions/56315007/ant-pattern-matching-to-select-file-is-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!