Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 32375 invoked from network); 5 Dec 2000 20:07:04 -0000 Received: from unknown (HELO slim.silverstream.com) (216.142.115.9) by locus.apache.org with SMTP; 5 Dec 2000 20:07:04 -0000 Received: by slim.silverstream.com with Internet Mail Service (5.5.2650.21) id ; Tue, 5 Dec 2000 15:06:56 -0500 Received: from ROSEN ([10.129.101.130]) by shady.silverstream.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id YC1KWQJZ; Tue, 5 Dec 2000 15:05:08 -0500 From: "Rosen, Alex" To: 'ant-dev' Subject: Zips with arbitrary layout Date: Tue, 5 Dec 2000 15:07:10 -0500 Message-ID: <001501c05ef6$f487a530$8265810a@silverstream.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Hi all. I'm trying to use Ant to let our users build a ZIP/JAR file with an arbitrary layout, putting any file anywhere in the archive they want. This is a superset of the WAR functionality. For example, I'd like to be able to put all files from c:\dev\classes\ into the archive at "web-inf/classes/", and all files from c:\images\project4\ into "images/", and the file c:\props\proj4.properties into "props/default.properties". I'd like to do this without copying files. I spent a while writing code for this in the 1.2 tree, creating a class that I called Zip2. Then I noticed a change to War.java, by Stefan about a month ago, that does something similar. Cool. However, I'd like to make a couple of suggestions: - I think it would be nice if this facility were in Zip.java, rather than War.java. Then, War could just be a special case of Zip - and all the J2EE archves (WAR, EJB JAR, EAR, Client JAR) would work the same way. E.g. right now it's not possible to create an EAR unless your deployment descriptor is named "meta-inf/application.xml" (or you don't mind copying it to that filename). This fix would let you create archives with any layout you wanted (EAR, WAR, new formats defined in the future, etc), without having to create a new task. - Another problem that keeps the above scenario from working is that the new prefix mechanism in War doesn't support renaming of files. E.g. if my deployment descriptor is named "proj4-ear.xml", I can't put it in the archive as "meta-inf/application.xml". In my Zip2.java, filesets not only support an "prefix" property (which I can "archivedir"), but also an "archivefile" property. This is the full filename to save the file as. It is only valid if the fileset represents a single file. E.g. - The new War uses sub-elements named "prefixfileset" (rather than "fileset"), which support the "prefix" property. I think it would be nice if you didn't need to remember to use this special name, and could just use regular elements. (This can be fixed by just changing the method name addPrefixedFileSet() to addFileSet().) - There's currently no way to create a War that contains *only* prefixed files. If you use only prefixfilesets, then it (Zip.java) thinks it has no filesets, so it throws an error, even though War.java is perfectly happy. Any opinions on these ideas? If people think this is a good idea, I'd be happy to submit a patch. Thanks! Alex