ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: Accessing classes in a path from a custom task
Date Mon, 21 Feb 2011 16:13:14 GMT
On Sat, Feb 19, 2011 at 9:17 AM, Allan Lewis <allan.e.lewis@gmail.com>wrote:

> I'm working on a custom ant task, and want to create a class based on
> classname provided to the task.  I've made a path available to the task,
> but
> can't quite figure out how to make those classes available to the task, so
> I
> wind up getting a java.lang.ClassNotFoundException when trying to create
> the
> class.
>
>
>
> In other words, given the following:
>
>
>
> <path id="my.path">
>
> <fileset dir="lib" includes="*.jar"/>
>
> </path>
>
>
>
> <path id="my.runtime.path">
>
> <fileset dir="lib-runtime" includes="*.jar"/>
>
> </path>
>
>
>
> <typedef name="mytask" classname="com.mytask.MyTask"
> classpathref="my.path"/>
>
>
>
> < mytask classpathref="my.runtime.path" classname="com.foo.Bar"/>
>
>
>
> What has to happen in order to get 'com.foo.Bar' available to my task at
> runtime?
>
> You might find org.apache.tools.ant.AntClassLoader useful for your
purposes.

HTH,
Matt

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message