Apache Ant – Adding a file to an existing zip archive

I recently needed to add a file to an existing WAR as part of an Ant build step. The Ant docs are not really clear on whether this is possible and there certainly isn’t an example.

This is the method I used:

<target name="dist" depends="build">
	<zip destfile="${rootBuildDir}/import/MyWebApp.war" update="true">
		<zipfileset dir="${distDir}" 
			includes="*.jar" prefix="WEB-INF/lib/"/>

As you can see I’ve used the generic zip task but the technique works for WAR, and JAR files too, since they are just zip files.

See the Ant docs for more info about the zip task and zipfileset type.

Edit: 2012-12-21 Updated link to ANT docs


Mandarin Duck

Warning: Invalid argument supplied for foreach() in /var/www/html/www.reast.net/wp-content/plugins/wordpress-flickr-manager/FlickrManager.php on line 335

Over the weekend we popped out to Thompson Park in Burnley for a walk in the snow and to feed the squirrels, but the snow seemed to be keeping the squirrels hidden. We did however find a whole flock of ducks all very keen for the feeding. Among the ducks we did see one rather unusual looking fellow, and as it turned out Wikipedia revealed it to be a Mandarin Duck. Here are a couple of photos we took, he seemed relatively tame.

Continue reading Mandarin Duck


Compositor Digital Photo Frame Keyring – Driver and Manual

I bought my daughter a 1 inch heart shaped digital photo frame keyring (keychain) and when it came time to hook it up to my Mac or PC I struggled to find the drivers, due mainly to the fact that the enclosed 8cm device driver CD isn’t friendly to slot-loading CD drives.

A quick web search and I failed to find the manufacturer’s website, fortunately a bit more hunting on my part and I did find the 8cm CD adapter that came with my PC. So I’m providing the contents of the CD here for anyone else who might go looking. These items are obviously copyright to the Compositor company, and if they find this site and want me to take the files down, I’ll happily link to their own drivers page. These items are specifically from the “Model PF 10.002 HEART” but they might work with other models too.
Continue reading Compositor Digital Photo Frame Keyring – Driver and Manual


JAXB 2.1 Generating Primitive Type Getters

We’ve been using JAXB generated classes at work for quite some time without problem. Recently it became necessary to make them serializable so we could stow certain objects safely in the HttpSession for later retrieval. So a quick look around on the web revealed the following example in the Sun docs showing how to use xjc’s extension mechanism to force generated classes to implement Serializable. All good. Except as it turns out the Sun docs included the generateIsSetMethod attribute on the <jaxb:globalBindings> element: <jaxb:globalBindings generateIsSetMethod="true">. Originally I included this attribute in my external bindings file that I passed to XJC, thinking I should follow the Sun example, but it soon became clear that this wasn’t the way to go: when I swapped the newly generated classes with our previous version a colleague spotted some of our code complaining about primitive types being returned from the Getters in the generated classes.
Continue reading JAXB 2.1 Generating Primitive Type Getters


Brace yourself, sometimes this might get technical.