ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <DDevie...@lgc.com>
Subject RE: declare tasks without taskdefs?
Date Fri, 25 Feb 2005 21:30:47 GMT
> -----Original Message-----
> From: Tim Julien [mailto:Tim.Julien@oracle.com]
> 
> Is org.apache.tools.ant.taskdefs.defaults.properties (in ant.jar) the
only
> way to get an ant task to work "out of the box".  I.e., without having
to
> do <taskdefs>.

Yes and no.

You always have to do 'something' to use custom tasks. Either use a
<taskdef>, or new in Ant 1.6+ simply by declaring an XML namespace with
a magic URI of the form antlib:<package>, where there's a antlib.xml
file in <package> (found inside the classpath used by Ant itself).

The magic XML namespace is as close as you'll get to not have to do
anything.

This is by design, as Ant wants to makes it explicit custom tasks are
used, rather than built-in ones.

For example, I could use my custom echo task as follows:

<project xmlns:bm="antlib:com.lgc.buildmagic">
  <bm:echo>Hello World</bm:echo>
</project>

and you haven't seen a single <taskdef> ;-)  --DD

PS: this assume com_lgc_buildmagic.jar is in ant/lib, and Ant 1.6+.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message