JarPatch is an ANT task (and standalone utility) that allow to build a diff zip file which contains the difference between 2 jar or war files (named newJar and oldjar). The diff file consist of:
The task has been tested using ANT 1.5.4 and ANT 1.6.2.
The easiest way is to include jarpatch-0.6.jar on the $ANT_HOME/lib directory.
To use the task in a build file, you will need the following taskdef
declaration:
<taskdef name="jarpatch" classname="org.jarpatch.JarPatchTask"/>
Alternatively, you can specify the jarpatch location with the classpath
attribute:
<taskdef name="jarpatch" classname="org.jarpatch.JarPatchTask" classpath="c:/somewhere/jarpatch.jar"/>
Attribute | Description | Required |
newJar | The new jar file, that define new or modified ressource | Yes |
oldJar | The old jar file, that is the reference to know which ressource are new or modified | Yes |
resultPatch | The resulting zip file, containing the new and modified ressources | Yes |
excludes | a comma separate list of regex pattern (JDK1.4 syntax) | No |
logDeleteFile | (Boolean) if true then add a file jarpatch_deleted.log on the resultPatch,
that contains the list of files that are found in oldJar but not in newJar (one line by file) |
No |
Run jarpatch to generate a patch from a 2 jar, excluding images ressources
<jarpatch newJar="${build}.lib/${app.jar}" oldjar="${dist}/lib/${app.jar}" resultPatch="${dist}/patch/patch-${build.number}.zip" excludes=".*\.gif, .*\.jpg"/>
Same, but called as a standalone utility
java -jar jarpatch.jar -new myNew.jar -old myOld.jar -out myPatch.zip -excludes .*\.gif,.*\.jpg
jarPatch is licensed with the LGPL license, meaning that is free and open source, and can be used for commercial projects.
Javadoc API documentation is available here.