I just had turn down a request to change the default value for an attribute of an Ant task again with "can't do because of backwards compatibility".

While I think this time the request wasn't a good one anyway (changing the default value for <war>'s roundup), there are other tasks where I really agree that Ant's default is wrong. My pet peeve is <ant>'s inheritall attribute. The initial version of this task passed down all properties to the sub build and so we had to keep it that way even after we understood that you most likely want to pass only a chosen few of them.

Luckily Ant 1.6.x's <presetdef> comes to rescue. This task hasn't seen as much attention as <import> or <macrodef>, but it really comes in handy.

  <presetdef name="myant">
    <ant inheritall="false"/>
  </presetdef>

and I have a <myant> task that works like I'd prefer <ant> to work. I can still override the new default with <myant inheritall="true"/>.

If you can live with

Trying to override old definition of task ant
that Ant issues to warn you in case of conflicts, you can even make that
  <presetdef name="ant">
    <ant inheritall="false"/>
  </presetdef>
and magically all <ant> tasks have changed their default.

For my own project I prefer a middle-ground using namespaces and the original task names. Something like

  <project xmlns:my="urn:mytasks">
    <presetdef name="ant" uri="urn:mytasks">
      <ant inheritall="false"/>
    </presetdef>
    ...
    <my:ant .../>

path: /en/Apache/Ant | #