问题
<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