Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@jakarta.apache.org Received: (qmail 99775 invoked by uid 500); 10 May 2001 11:08:51 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: ant-user@jakarta.apache.org Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 99718 invoked from network); 10 May 2001 11:08:43 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 content-class: urn:content-classes:message MIME-Version: 1.0 Subject: RE: How to update a jar? Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Thu, 10 May 2001 12:08:40 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How to update a jar? Thread-Index: AcDZP/z0cF93Ab65Q/i8gNwkYgNakAAALZ2g From: "Jon Skeet" To: , X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N [Deliberately cross-posted as a migration path from user to dev. Apologies for any confusion/offence caused.] > Jon Skeet wrote: >=20 > >> It is all coded up, using java.util.zip classes in Ant 1.3 and > >> using a new org.apache.tools.zip package in Ant 1.4alpha. > >=20 > > Okay, that presumably makes it a right royal pain to attempt to > > write a patch to allow this (as a newbie when it comes to Ant > > development). >=20 > It depends on your experience. If you know the java.util.zip classes, > its not that difficult (the new ones are an extension of ZipEntry and > a new implementation of ZipOutputSteam with an interface identical to > the standard one). In fact it's not even that hard - I'm just going to create a new=20 ZipFileSet using the temporary file and call addFiles with that and the new zip file. The "pain" is patching two sets of source code :) > > It strikes me it would be useful to allow this for zip as well as > > jar, by the way. >=20 > Sure. Jar is a child class of Zip, it just adds special treatment for > the manifest file, that's all. All changes should happen for zip as > , and would benefit from them immediately. > > > There is one slight wrinkle, however: with the jar version I believe > > you'd want to exclude the original manifest from the list of files > > being added. >=20 > Could be specified by using patterns - maybe jar would optionally > exclude META-INF/MANIFEST.MF while war excludes WEB_INF/web.xml and so > on. Right. My initial thought was to have a protected getUpdateZipFileSet=20 method and override it in subclasses - does that seem reasonable, or would it be better just to have a getUpdateExclusion method which returned the pattern to exclude? =20 > > Is there an easy way to effectively code up the bit of Ant XML > > within the zip (or jar) task, >=20 > take a look at the optional RenameExtension task in Ant 1.3, it simply > maps itself to an invocation of move under the covers. Right - yup, quite doable, but not much easier than using straight IO. Nice to see just as an example for any future tasks I might right though. > > or would I be better off using the Java IO libraries directly for > > the move/delete operations? >=20 > I'd do so. Goodo - as that's what I'm half-way through doing :) If anyone wants to=20 volunteer to help test it (and proof-read the code!) when I'm done, let me know off-list. =20 > > Oh, and at what stage is this discussion best moved to the Dev list? >=20 > Four or five messages ago 8-) LOL. Okay, I'll do the dirty and cross-post this one, then we can continue just on dev. Jon