Diane,
I finally figured it out and may have uncovered a bug in Ant 1.4.1 in the
process. I got the jlink task to produce a correct jar, but when I included
that jar as a zipfileset in a jar task, I got the following error:
build\build.xml:135: Problem creating jar: invalid stored block lengths
I suspected the jar produced from jlink was corrupt, so I tried jar xf
tmp.jar -- here's what I got:
C:\cvs\build\lib\temp>jar xf tmp.jar
java.util.zip.ZipException: invalid stored block lengths
at
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:139)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:142)
at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:93)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:71)
at sun.tools.jar.Main.extract(Main.java:676)
at sun.tools.jar.Main.run(Main.java:191)
at sun.tools.jar.Main.main(Main.java:904)
I tried the jlink task without compresssion it worked just fine. Looks like
there's a bug when producing a jlink'd jar with compression on?
FYI, here's my final target that works:
<target name="jar" depends="compile">
<mkdir dir="${basedir}/build/lib/temp" />
<jlink outfile="${basedir}/build/lib/temp/temp.jar" compress="yes">
<mergefiles>
<fileset dir="${build.lib.merge.dir}" includes="*.jar" />
</mergefiles>
</jlink>
<jar
jarfile="${jar.dest.dir}/foo.jar"
manifest="${resources.dir}/share/manifest.mf"
>
<!-- Main .class files: -->
<fileset dir="${build.dest.dir}" includes="com/foo/**/*.class" />
<!-- i18n properties files: -->
<fileset dir="${i18n.dir}" includes="*.properties" />
<!-- Add in merged jars: -->
<zipfileset src="${basedir}/build/lib/temp/temp.jar" />
</jar>
<delete file="${basedir}/build/lib/temp/temp.jar" />
</target>
Thanks for all your help,
--Bill
> -----Original Message-----
> From: Diane Holt [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 28, 2002 8:33 PM
> To: Ant Users List
> Subject: RE: Add contents of multiple JARs to a Jar?
>
>
> --- Diane Holt <[EMAIL PROTECTED]> wrote:
> > I think you need to use <mergfiles>, don't you?
>
> And for the record, I just tried it and it worked fine -- put the contents
> of the two jars into the output jar.
>
> Diane
>
> =====
> ([EMAIL PROTECTED])
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Greetings - Send FREE e-cards for every occasion!
> http://greetings.yahoo.com
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>