Now that Ant has chosen to define a lot of optional tasks via the optional.jar in the ant/lib directory, we are forced to put the required 3rd party libraries in that directory. To me that is work only half done. I do understand that the Ant distribution cannot include all the required libraries (due to license and maintenance issues). But this requirement is the only thing that prevents us from checking all the needed libraries for a project into a source control system and simply asking users to checkout and type ant. Ok, that was the problem. Here is how I think it could be solved. There are a few ways as I see it. Option 1) AFAIK, Ant implements its own ClassLoader. Wouldn't it be possible to somehow pass the location of required libraries to that class loader at startup time? Option 2) Extend the Ant wrapper scripts with a classpath argument that will be appended to the the classpath before executing Ant. Option 3) Extend the Ant wrapper scripts so that it will include a .antrc from the directory of the build file. The first option is in my view the right way of doing it. The second and third are a work-arounds that for most cases would probablt be good enough. I am aware that you can have the wrapper scripts read a .antrc from the user's home directory. But this is not good enough because different projects have different library requirements.
Ant 1.6 uses a new Launcher. I adds all JARs in the ANT_HOME/lib, USERHOME/.ant/lib and all JARs added via -jar option to Ant´s classpath.