Applies a diff file to originals. Requires patch to be on the execution path.


Attribute Description Required
patchfile the file that includes the diff output Yes
originalfile the file to patch No; tries to guess it from the diff file
destfile the file to send the output to instead of patching the file(s) in place. since Apache Ant 1.6 No
backups Keep backups of the unpatched files No
quiet Work silently unless an error occurs No
reverse Assume patch was created with old and new files swapped. No
ignorewhitespace Ignore whitespace differences. No
strip Strip the smallest prefix containing num leading slashes from filenames. No
dir The directory in which to run the patch command. No; default is the project's basedir
failonerror Stop the build process if the command exits with a return code signaling failure. since Ant 1.8.0 No; defaults to false


Apply the diff included in module.1.0-1.1.patch to the files in base directory guessing the filename(s) from the diff output.

<patch patchfile="module.1.0-1.1.patch"/>

Here, one leading directory part will be removed:

<patch patchfile="module.1.0-1.1.patch" strip="1"/>

i.e. if the diff output looked like

--- a/mod1.0/A  Mon Jun  5 17:28:41 2000
+++ a/mod1.1/A  Mon Jun  5 17:28:49 2000

the leading a/ will be stripped.