JarPatch ANT Task 0.6

Description

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:


This diff file can be use as a patch for a previous installation (just ensure that the generated patch.zip file is located on the CLASSPATH before the patched oldJar jar file).

The task has been tested using ANT 1.5.4 and ANT 1.6.2.

Download

Download jarpatch distribution: jarpatch-0.6.zip
it contains the compiled jarpatch.jar and all source/test stuff.

Installation

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"/>

Parameters

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

Examples

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

License

jarPatch is licensed with the LGPL license, meaning that is free and open source, and can be used for commercial projects.

API Documentation

Javadoc API documentation is available here.

History


Feedback to Norbert Barbosa