Use 'copy' before using the Ant 'sync' task

For what it is worth, here is a little trick I like to use when using the Ant 'sync' task..... The problem is that with very large sync actions, your Java environment may run out of memory and the Ant task fails with an error. You may also find that the sync task takes a very, very, long time. This won't happen with most personal or small team-sized builds but does occur when using Ant for moving 10's of thousands of files around. I find that if I run the copy task before using sync on the same fileset then things go much better. Logically, this doesn't add to the work you are doing - part of a sync will be to copy the new files. This just breaks things into two parts - the initial copying of the new files and then the sync part that will delete any files in the target directory that aren't in the source. You can also increase, either permanently or temporarily, the amount of memory allocated to your Java environment. - Brian

No comments: