ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Allan <ste...@wrq.com>
Subject RE: Combining JARs into one JAR
Date Wed, 12 Jun 2002 23:40:00 GMT
> -----Original Message-----
> From: ajack [mailto:ajack@openbiz.biz]
> Sent: Wednesday, June 12, 2002 3:25 PM
> To: 'Ant Users List'
> Subject: RE: Combining JARs into one JAR
> 
> 
>  
> 	> I know the real problem is probably elsewhere, but is there 
> 	> any simple way (via Ant) to bundle these JARs back 
> into one big 
> 	> JAR?
> 
> 	You could build a new jar file with all the others 
> listed as zipfilesets.
> 
> I presume you were referring to something like this. Perhaps 
> inelegant, but I unjar the *.class files into a tree, then re-jar.
> 
>         <!-- Put all classes in ${dist} into ${bundle} -->
>         <unjar dest="${bundle}/classes">
>             <patternset>
>                 <include name="**/*.class"/>
>             </patternset>
>             <fileset dir="${dist}">
>                 <include name="**/*.jar"/>
>                 <exclude name="**/*-source.jar"/>
>                 <exclude name="**/*-javadoc.jar"/>
>             </fileset>
>         </unjar>
> 
>         <jar    jarfile="${bundle}/openbiz-bundle.jar"
>                 basedir="${bundle}/classes">
>         </jar>
> 

I've tried this both of the suggested ways and using zipfilesets is *much*
faster than unjarring everything and then rejarring.  The downside, is if
you have two or more zipfilesets wich happen to contain class files with the
same name, both get included in the resulting jar file, which is usually
very, very bad.  But, it seems to me that would probably only happen when
you're including third parting jars in your jar file.

Anyway, FWIW...

-- Steve __

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message