I've done something similar to Keith C's answer, so thought I'd include it here as well.
I've set up an 'unzippedStaticResources' directory within my project where I store the unzipped version of my static resource. When I do an ant deploy
, an ant task automatically zips up the contents and copies it to the staticresource directory before the deployment happens.
Zip macrodef
<macrodef name="zip-static-resource">
<attribute name="zipName"/>
<sequential>
<echo message="Zipping: @{zipName}"/>
<zip destfile="${srcDir}/staticresources/@{zipName}.resource" basedir="${unzippedDir}/@{zipName}" update="true" whenempty="fail"/>
</sequential>
</macrodef>
To deploy
<target name="deploy">
<sequential>
<zip-static-resource zipName="myZipFile1"/>
<zip-static-resource zipName="myZipFile2"/>
<sf:deploy ..... />
</sequential>
</target>
Then when I want to retrieve metadata from Salesforce, I automate the unzipping of the static resource and copy it to the unZipped directory.
Unzip macrodef
<macrodef name="unzip-static-resource">
<attribute name="zipName"/>
<sequential>
<echo message="Unzipping: @{zipName}"/>
<delete dir="${unzippedDir}/@{zipName}"/>
<unzip src="${srcDir}/staticresources/@{zipName}.resource" dest="${unzippedDir}/@{zipName}" failOnEmptyArchive="true"/>
</sequential>
</macrodef>
To retrieve
<target name="retrieve">
<sequential>
<sf:retrieve ..... />
<unzip-static-resource zipName="myZipFile1"/>
<unzip-static-resource zipName="myZipFile2"/>
</sequential>
</target>
In this code I have a few properties set up:
<property name="srcDir" value="src" />
<property name="unzippedDir" value="unzippedStaticResources" />
I'm pretty new to Ant, so let me know if there's a better way to do things.
Ideally, I'd like the Ant script to automatically unzip all *.resource files (that are zip files) in the staticresource directory, and automatically zip up all directories in my 'unzippedStaticResources' directory.