Ant: how to list files that are copied/compiled


Ant is a good tool to automate the project build / deploy process (especially for java projects). What’s more, it can also be an general tool used for file synchronization, backup and etc.

When i used ant to synchronize my folder in the desktop computer to my usb flash drive, i wanted to know what exact files have been copied over for synchronization. However, by default, ant only shows how many files have been copied over.

I tried adding option “–verbose” (or “-v”) to the ant command. But this option make the output too verbose to tell the copied files.

Finally, I found the solution. It’s actually very easy. In the “build.xml” file, for the “copy” task, just add the attribute “verbose” with the value “true”. For example:

<target name=”backup-download” description=”backup”>
<copy todir=”${todir}” verbose=”true”>
<fileset dir=”${download}” ></fileset>
</copy>
</target>

This “verbose” attribute is also available for the task “javac”, which means you can list java files that are actually compiled with this attribute turned on.

One Response to “Ant: how to list files that are copied/compiled”

  1. Hello. I think the article is really interesting. I am even interested in reading more. How soon will you update your blog?

Leave a Reply

Spam Protection by WP-SpamFree