例子
项目文件
├── build.xml
├── dest_folder
│ └── subfolder1
│ ├── file2
│ └── file3
└── src_folder
└── subfolder1
└── file1
构建输出
$ ant
Buildfile: build.xml
copy-files:
[copy] Copying 1 file to dest_folder
[copy] Copying src_folder/subfolder1/file1 to dest_folder/subfolder1/file1
run-cmd-on-files-in-dest-folder:
[apply] dest_folder/subfolder1/file1
clean-files:
[delete] Deleting dest_folder/subfolder1/file1
构建.xml
<project name="demo" default="run">
<target name="run" depends="copy-files,run-cmd-on-files-in-dest-folder,clean-files"/>
<target name="copy-files">
<copy todir="dest_folder" verbose="true">
<fileset dir="src_folder"/>
</copy>
</target>
<target name="run-cmd-on-files-in-dest-folder">
<apply executable="echo">
<srcfile/>
<fileset dir="dest_folder">
<present present="both" targetdir="src_folder"/>
</fileset>
</apply>
</target>
<target name="clean-files">
<delete verbose="true">
<fileset dir="dest_folder">
<present present="both" targetdir="src_folder"/>
</fileset>
</delete>
</target>
</project>