ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rosen, Alex" <>
Subject Zips with arbitrary layout
Date Tue, 05 Dec 2000 20:07:10 GMT
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\ into
"props/". 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, 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, rather than 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, 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.

  <fileset dir="${src}" includes="proj4-ear.xml"
archivefile="meta-inf/application.xml" />

- 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 <fileset>
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 ( thinks it has no filesets,
so it throws an error, even though is perfectly happy.

Any opinions on these ideas? If people think this is a good idea, I'd be happy
to submit a patch.


View raw message