The internals of Ant 1.6 have changed since past versions. Developers can take advantages of these changes to write a task, or a library of tasks. This article talks about the new namespace aware Ant, writing tasks, and common pitfalls.

XML Namespace
Now imagine that your application server provider offers a <deploy> task that lets you re-deploy your application to the application server without restarting the server process.

Prior to Ant 1.6 you had to rename one of the two tasks if you wanted to use both inside the same build file. Starting with Ant 1.6 you can qualify the tasks and types by XML namespaces[1]. For Ant's purpose an XML namespace simply consists of an URI identifying it and a prefix that you want to use for it in your XML file.

Simply pick a prefix and an URI and you are set:


  <project ... xmlns:mylib="org.example">
    <typedef name="slave" classname="org.example.Slave" uri="org.example"/>
    <taskdef name="deploy" classname="org.example.Rsync" uri="org.example"/>
    <mylib:slave hostanddir="slave1:/www" id="slave1"/>
    <mylib:slave hostanddir="slave2:/www" id="slave2"/>
    <mylib:deploy master="some-dir">
      <mylib:slave refid="slave1"/>
      <mylib:slave hostanddir="slave3:/www"/>
    </mylib:deploy>
  </project>
Part 2: Ant 1.6 for Task Writers:

Related Article: Part 1: New Ant 1.6 Features for Big Projects -- Learn new features of Ant 1.6 and see how they might impact the way you structure your build process.(http://otn.oracle.com/pub/articles/bodewig_ant1.6.html)