ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <cmanola...@yahoo.com>
Subject Re: PROPOSAL: loading tasks from jars for Ant 1.5
Date Wed, 10 Oct 2001 18:37:57 GMT
On Wed, 10 Oct 2001, Sam Ruby wrote:

> > 2. Alter Project.java to discontinue the use of the
defaults.properties
> > files, and instead do a ClassLoader.getResources("meta-inf/antlib.xml"),
> and
> > process each of those on startup.
>
> Note: getResources is JDK 1.2.  Is is the Ant community ready to make that
> leap just yet?
>
> I am not familar enough with this method, and the documentation is vague
> enough.  If there are multiple jar entries on your classpath, with the
> standard system class loader find all of them?

First, if we do that I think we should use the pattern that is recomended
by the jar spec, META-INF/services/org.apache.tools.ant.Task.

See:
http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service Provider

Regarding getResources() and JDK1.1, we can emulate this in our class
loader. For what we need, task definitions loaded from jars
declared in build.xml - there is no problem, we don't even need
getResources() ( antlib/taskedef can look in each jar ).

Having a 1.1 compatible getResources() would be quite usefull code to
have in general.

> > 3. Add a new task "antlib" which can be used to load a jar file
> containing
> > ant tasks and datatypes.  This would be used in case someone doesn't want
> to
> > drop their antlib into $ANT_HOME/lib.
> >
> > e.g.
> >   <antlib file="foo.jar"/>
>
> Count me in those that don't want to drop jars into $ANT_HOME/lib.
>
> Shouldn't antlib accept a Path specification?  I'd also like it to respect
> the value of build.sysclasspath.

+1 ( on not droping files in ANT_HOME/lib ).

<taskdef> already supports most of what you want for antlib - I haven't
followed the whole thread, but IMHO taskdef is doing a pretty good job, and I think
antlib should follow the same patterns.

What might be interesting is having automatic deployment ( where you
don't use <antlib> or <taskdef>, but tasks are automatically defined by
placing them in a dir ). Similar with webapps/ dir.
Not sure it's a good idea ( ext/ is a nightmare ), I prefer explicit
definitions for tasks.

BTW, what's the relation between <antlib> and <taskdef> and why are we
adding a new tag instead of extending the old one ?

Costin




Mime
View raw message