如何在 ant zip 任务中使用 excludesfile/includesfile

how to use excludesfile/includesfile in ant zip task

我需要指定要排除的特定文件的列表,但是当我尝试类似 excludesfile="file1, file2" 的操作时,我在执行任务时遇到错误:

C:\Users.....\Desktop\testProject\project.build.xml:49: Excludesfile C:\Users......\Desktop\testProject\file1, file2 not found.

这是我的代码:

<target name="jar" depends="common.jar">
    <zip 
        destfile="${jar.build.dir}/some-jar.jar"
        basedir="${base.dir}"
        includes="src/**,gradle/**"
        excludesfile="file1,file2">
    </zip>
</target>

excludesfile 用于指定包含要在 zip 进程中排除的文件列表的文件(每个文件在单独的行上)。要将列表指定为逗号(或 space)分隔的文件,请使用 excludes 参数。例如:

excludes="file1,file2"