How do I zip and unzip files using Ant?
Author: Deron Eriksson
Description: This Ant tutorial describes how to zip and unzip files.
Tutorial created using:
Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1
(Continued from page 1) If we open our project's build.xml file in the EclipseSW AntSW view, we can double-click the 'zip' target to run it. It's execution is shown below. Notice that the zip-test.zip file gets created at the root level of our project. If we double-click the 'unzip' target in the Ant view, the zip-test.zip file's contents get unzipped into the 'unzipped' directory. Only two of the files from our original directory are unzipped to the 'unzipped' directory since the third file from our original directory began with 'dont' and was excluded from the zip-test.zip archive. If we double-click the 'clean' target, the zip-test.zip file and the 'unzipped' directory get deleted so that our project is cleaned up. It's that easy! For more information regarding the zip and unzip tasks, you can consult the online Ant manual. Related Tutorials:
|