You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Scott Ellsworth <sc...@alodar.com> on 2002/04/30 04:13:52 UTC

Will the new ZipFileSet let me specify more than one zip file in the src attribute?

Hi, all.

Will the new 1.5 zipfileset let me specify a src as a collection of 
jars, rather than needing one zipfileset per jar file?

I am planning our migration to ant 1.5 beta.  One of the motivators is 
better jar bundling.  (Here, I mean taking half a dozen jar files and 
copying their contents into the output jar.)

We currently have constructs like:

   <target name="bundle" depends="bundle-zip1, bundle-zip2, 
bundle-zip3" />

   <target name="bundle-zip1" depends="init" if="jar.extra.zip1" 
description="unzip any zips to be bundled in the result">
     <unjar src="${jar.extra.zip1}" dest="${compile.classes}"/>
   </target>

   <target name="bundle-zip2" depends="init" if="jar.extra.zip2" 
description="unzip any zips to be bundled in the result">
     <unjar src="${jar.extra.zip2}" dest="${compile.classes}"/>
   </target>

   <target name="bundle-zip3" depends="init" if="jar.extra.zip3" 
description="unzip any zips to be bundled in the result">
     <unjar src="${jar.extra.zip3}" dest="${compile.classes}"/>
   </target>

   <target name="jar-manifest" depends="bundle">
     <mkdir dir="${jar.dist}"/>
     <jar
       jarfile="${jar.dist}/${jar.baseName}-${DSTAMP}.jar"
       basedir="${compile.classes}"
       compress="${jar.compress}" >
     </jar>
   </target>

and a project might have

bundle-zip1="../foodir/foo.jar"
bundle-zip2="../bardir/bar.jar"

So, we might have up to 25 "bundle-zip##" variables and targets, and it 
is a tad confusing and hard to maintain.

As I understand it, I will soon be able to change the above to:

   <target name="jar-manifest" depends="bundle">
     <mkdir dir="${jar.dist}"/>
     <jar
       jarfile="${jar.dist}/${jar.baseName}-${DSTAMP}.jar"
       basedir="${compile.classes}"
       compress="${jar.compress}" >
       <zipfileset src="${bundle-zip1}">
       <zipfileset src="${bundle-zip2}">
       <zipfileset src="${bundle-zip3}">
     </jar>
   </target>

and will get exactly the same results.  This still requires an explicit 
list of bundle-zip properties.  I am pretty happy about getting rid of 
the extra targets, but it would be nice to get rid of a bunch of 
properties as well.

Is there any planned syntax for a zipfileset like:

       <zipfileset src="${bundle-zip}">
where

       bundle-zip="../foodir/foo.jar:../bardir/bar.jar"

I am not that concerned with syntax, more that I will be able to specify 
a list of jars whose contents are to be extracted as a single property, 
much like a classpath.

Includes and excludes will not work for this, as they related to files 
_inside_ the zip/jar files.

Scott


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Will the new ZipFileSet let me specify more than one zip file in the src attribute?

Posted by Diane Holt <ho...@yahoo.com>.
--- Scott Ellsworth <sc...@alodar.com> wrote:
> Will the new 1.5 zipfileset let me specify a src as a collection of 
> jars, rather than needing one zipfileset per jar file?

Doesn't look like it. There's a <zipgroupfileset>, though:
  A <zipgroupfileset> allows for multiple zip files to be merged
  into the archive. Each file found in this fileset is added to the
  archive the same way that zipfileset src files are added.

So if your source zip files can be wildcarded for an 'includes' (not sure
if it takes nested <include>'s or not), you may be able to cut down at
least some on the number you'd need to list.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>