----- Original Message ----- From: "Tim Dawson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, October 05, 2001 9:09 AM Subject: Ant 1.5... loading tasks from jars?
> I made the suggestion back in May to allow loading tasks from jars (a > tasklib, if you will), and I know it is currently listed in the 2.0 > requested features, but it appears to be possible today... > > <taskdef resource="meta-inf/ant.tdf"> > <classpath> > <pathelement location="mylib/mytasks.jar"/> > </classpath> > </taskdef> > > Of course, this is a completely non-obvious solution, which is why its still > a requested feature. :-) sounds like a documentation bug to me; nobody has updated the developing for ant page for a while. > > I believe what is wanted by people is something more along the lines of: > > <tasklib file="mylib/mytasks.jar"/> > <snip> > Doing the automatic inclusion of tasks from jar files in the lib dir would > be easily implemented using ClassLoader.getResources() (suggested by Dan > Barclay back in May when this topic came up initially) and would really > improve the way Ant currently packages the optional tasks. It is really > quite strange that the main ant.jar file has a defaults.properties file that > contains taskdefs for optional tasks. Both ant.jar and optional.jar should > have a "meta-inf/ant.tdf" (or whatever we use for the standard) file to > contain a list of what tasks are inside that jar file. > I think one of the goals (at least as I envisaged it) was to be able to drop jars into the ant lib directory and have their tasks registered. The taskdef task should also be able to pull in new jars and determine what tasks they contain. I also believe that the consensus was around around some XML declaration of what ant tasks there are, probably like the taglib one, except easier to generate. [NB: check out xdoclet.sourceforge.net for ant tasks to do that]. Even while ant2.0 is in the undefined state, we could progress with some dynamic enumeration and loading of jar files with some task descriptor, provided we choose a task descriptor which is extensible to whatever ant 2.0 wants. Maybe we could code up some very simple xml DTD for deploying ant1.x tasks, which includes a version identifier so future ant versions can recognise the version of the descriptor and react accordingly. <antdefs version="1.5"> <taskdefs> <taskdef name="..." class="..."/> </taskdefs> <typedefs/> This would be easy, using jaktarta-digest or just pure DOM code. It would avoid the issue of taskdef clashes, but we avoid that today anyway. Does this seem like a good idea? -steve
