ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject RE: declare tasks without taskdefs?
Date Fri, 25 Feb 2005 21:30:47 GMT
> -----Original Message-----
> From: Tim Julien []
> Is (in ant.jar) the
> way to get an ant task to work "out of the box".  I.e., without having
> 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

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>

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:
For additional commands, e-mail:

View raw message