我试图排除所有包含字符串" export"的目录。只有一个名为" exportspecial"的目录应该包括在内。
这种方式" exportspecial"仍然不包括在内:
<fileset dir="${dir.root}/plugins" id="something">
<include name="abc/**" />
<exclude name="abc/*export**" />
<include name="abc/exportspecial/**" />
</fileset>
答案 0 :(得分:0)
您可以使用selectors
<fileset dir=".">
<include name="abc/**"/>
<or>
<filename name="**/exportspecial/**"/>
<not>
<filename name="**/*export*/**"/>
</not>
</or>
</fileset>
示例构建文件:
<project name="selector-test" default="includeTest" basedir=".">
<target name="includeTest" depends="prepare">
<path id="export.path">
<fileset dir=".">
<include name="abc/**"/>
<or>
<filename name="**/exportspecial/**"/>
<not>
<filename name="**/*export*/**"/>
</not>
</or>
</fileset>
</path>
<pathconvert pathsep="${line.separator}"
property="echo.include.path"
refid="export.path"/>
<echo>${echo.include.path}</echo>
</target>
<target name="prepare">
<touch file="abc/test/inc" mkdirs="true"/>
<touch file="abc/exportspecial/inc" mkdirs="true"/>
<touch file="abc/export/exc" mkdirs="true"/>
<touch file="abc/inc"/>
</target>
</project>