On 2010-02-11, Josh Stratton <strattonbra...@gmail.com> wrote: > I'm using jarjar as I'm told it is useful for bundling jar > dependencies into a single distributable jar file. I have a problem > though in how jars are unzipped. This is probably a simple ANT > question, but I haven't had much luck with finding help on it in java > related forums, so I thought I'd go directly to the source (unless > that is the jarjar site...).
I'm afraid the jarjar support might be the better place. > <target name="package"> > <taskdef name="jarjar" > classname="com.tonicsystems.jarjar.JarJarTask" > classpath="./lib/jarjar.jar"/> > <jarjar jarfile="dist/inkspot.jar"> > <fileset dir="./build/classes"/> > <!-- <zipfileset src="./lib/scala.library_2.7.5.final.jar"/> > --> // line A > <zipfileset dir="./lib"/> // line B > <zipfileset dir="${jogl.dir}"/> > </jarjar> > </target> > I'm trying to include the scala library jar into my code. It has six > jars inside of it (scala-swing.jar, scala-library.jar, etc.). <zipfileset> won't help here since it only does one level of un-nesting and you'd need two (extract the main jar then extract the nested jars). If you are using Ant 1.8.0 and <jarjar> is an extension of <jar> that supports arbitrary resource collections just like <jar> does (I think it is, I'm not sure) then the new <archives> resource collection can help. If you put <archives> <zips> <zipfileset src="./lib/scala.library_2.7.5.final.jar"/> </zip> </archives> as a nested element into your jarjar task it will first extract all files from the big jar (the inner zipfileset) and then treat them as zips and extract all files from them. See http://ant.apache.org/manual/CoreTypes/resources.html#archives Oh no, on second thought it won't work, sorry. Ant's built-in ZIP classes can only read from files, not from streams. What you'd need would be the archives resource collection from the (not yet released) Compress Antlib which sits on top of Apache Commons Compress and does support readings ZIPs from streams. http://ant.apache.org/antlibs/compress/index.html Unless you are willing to build the library yourself (supposed to be released soonish), the only workaround is to manually extract scala.library_2.7.5.final.jar and use a zipgroupfileset on the dir holding the extracted files - this should work with almost any version of Ant: <property name="extracted" location="${java.io.tmpdir}/extracted"/> <mkdir dir="${extracted}"/> <unzip src="./lib/scala.library_2.7.5.final.jar" dest="${extracted}"/> <jarjar ...> <zipgroupfileset dir="${extracted}"/> </jarjar> <delete dir="${extracted}"/> Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org