You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jeff Crump <je...@gmail.com> on 2011/06/16 17:48:59 UTC

Zipfileset on classpath

Hi,

I would like to set up my JUnit classpath to include all of the jars in a
given zip file.  I'm using Ant 1.8.2. Everything I read tells me this ought
to work...

<zipfileset id="my.zip" src="/path/to/my.zip" includes="*.jar"/>

<junit ...>
  <classpath>
      <fileset refid="my.zip".>
  </classpath>
</junit>

but verbose/debug output is telling me it's not finding the jars in the Zip:

dropping /path/to/my.zip:myjar from path as it doesn't exist

So it appears that it's finding the Zip and the Jars in it (they are all
listed in similar "dropping" warnings) but ultimately I get
"NoClassDefFound" errors at runtime, so it's obviously not finding the Jar
bits.

Any suggestions?

Re: Zipfileset on classpath

Posted by Matt Benson <gu...@gmail.com>.
On Thu, Jun 16, 2011 at 10:48 AM, Jeff Crump <je...@gmail.com> wrote:
> Hi,
>
> I would like to set up my JUnit classpath to include all of the jars in a
> given zip file.  I'm using Ant 1.8.2. Everything I read tells me this ought
> to work...
>
> <zipfileset id="my.zip" src="/path/to/my.zip" includes="*.jar"/>
>
> <junit ...>
>  <classpath>
>      <fileset refid="my.zip".>
>  </classpath>
> </junit>
>
> but verbose/debug output is telling me it's not finding the jars in the Zip:
>
> dropping /path/to/my.zip:myjar from path as it doesn't exist
>
> So it appears that it's finding the Zip and the Jars in it (they are all
> listed in similar "dropping" warnings) but ultimately I get
> "NoClassDefFound" errors at runtime, so it's obviously not finding the Jar
> bits.
>
> Any suggestions?
>

A Path consists only of filesystem resources.  You'll need some
mechanism to extract them.  About three years ago I dropped a sandbox
antlib called fscache (see http://ant.apache.org/antlibs/sandbox.html)
to do this on-the-fly.  YMMV, but its tests still pass FWIW.

Matt

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