ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <>
Subject [PATCH] Several improvements to Zip and Jar tasks
Date Wed, 16 Aug 2000 10:29:21 GMT
The attached patch should fix several things with the Zip and Jar tasks:

1. Directories are now included in the archive as needed (all parent
dirs for specified files). These are stored in STORED mode like other
zip and jar tools do. I'm not sure if officially directories are
required or not, but anyway everyone else stores them and sometimes code
assumes they are there.

2. Jar task will now rebuild the JAR if it is out of date with respect
to the manifest (assuming you specified a manifest).

3. Zip task will now try to create a ZIP archive when no files matched.
In fact, this will cause a BuildException, stating that you are trying
to make an empty ZIP (I don't know if this should be possible, but
anyway* currently won't let you). Previously the task
would quietly fail to do anything at all, which seemed confusing and
inconsistent to me at least and probably did not benefit anyone (but if
you disagree it should be easy to revert this). For JARs, since a
manifest is always included, it does not matter whether any files match
or not; the JAR will always be created anyway. (If someone wants to
revert Zip to create nothing if no files match, please ensure this does
not apply to Jar since empty JARs can be useful occasionally--I needed
it recently.)

4. Problems occurring during archive creation were not reliably
reported; there were logic flaws in the error handling. I think I have
cleaned this up. For example, re. #3, when creating an empty ZIP (after
fixing dependency code to not treat the missing file as up-to-date) a
ZipException is thrown when the stream is closed; the previous code
silently swallowed it. It is now correctly propagated into a

5. Just for fun, the default JAR manifest now says it was created by Ant
(and gives the version).

Tested only on Linux with 1.3, your mileage may vary.


Jesse Glick   <>
NetBeans, Open APIs  <>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR
View raw message