<touch>

Using the <touch> task, you can update the modification time of one or more files. The modification time can be changed to the current time (by default), or you can specify an exact time to be used. You can also use the <touch> task to create a file that doesn’t already exist simply by specifying a nonexistent file. With that in mind, it is important that you specify the files correctly because no error is reported if a specified file doesn’t exist, obviously.

One example in which <touch> is useful is to force Ant to recompile an entire source tree by making it believe that the files have been modified.

Table 4.79 describes the attributes of the task.

Table 4.79. Table of <touch> Attributes
Attributes Description
Required
file (required ...

Get Ant Developer’s Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.