Hi Todd, the problem is your call to Class.forName(String) in ...Engine. This uses Engine's Classloader.
There are the following ways to add user-defined classes: 1. let the user add them to the classpath of the task's classloader or a one of it's parents by 1.1. specify them in <taskdef>'s classpath-attribute of the migrate-task or 1.2. add them via something like the <classloader> task (see http://enitsys.sourceforge.net/ant-classloadertask/) or (IMHO better) 2. refactor the Engine class: All methods that use Class.forName(String) should get an parameter "ClassLoader classloader" and you should use Class.forName(String,boolean,ClassLoader) instead. The methods with the "old" signature should be redirected to the new methods with classloader=Engine.class.getClassLoader(). In your task you have to create a new Classloader: if cp is your resolved classpathref, use new AntClassLoader(getClass().getClassLoader(),getProject(),cp) to construct the new classpath. cheers Rainer Noack -----Ursprüngliche Nachricht----- Von: todd runstein [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 21. November 2007 23:26 An: Ant Users List Betreff: Re: How do I set a classpath for my custom task? The project is non platform specific, so it can run in a container, in a swing app, or from the command line. The project applies schema changes to a database. The user creates a class that implements a single interface, adding code that the project uses to apply the changes. I've currently got this working from the command line and in a servlet (in it's init method). I really want to create a simple to use ant task so schema changes can be applied prior to deployment, test runs, or whatever, but I can't get this classloader thing figured out. Not sure if it's helpful, but if you need more specifics about what I'm trying to do, the project is on sourceforge under the name migrate4j. If there's more info that I can provide, just let me know. Todd On Nov 21, 2007 1:40 PM, Martin Gainty <[EMAIL PROTECTED]> wrote: > > Hi Todd-Could you provide a bit more contextWill you be implementing this (web)application under J2EE server -or- perhaps a container such as Catalina or Jetty?Generally these environments support their own classloader loading algorithms depending on the capability and security characteristics of the (web)application you will be implementing and which J2EE server and container will be the implementor-Martin -- ---------------------------------------------------------------------- The only "dumb question" is the one you were too afraid to ask. ________________________________________ Check out RouteRuler - Free software for runners, cyclists, walkers, etc. http://routeruler.sourceforge.net ________________________________________ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]