Almost two weeks ago (gee, I must find more time, somewhere, somehow) Vincent Massol talked about "reusable Ant tasks".

Looking closer, he doesn't really want to reuse the Ant tasks, he wants to reuse logic from the tasks. Instead of

Expand expand = new Expand();
expand.setSrc(new File(zipfile));
expand.setDest(new File(destdir));
expand.setLogger(myLogger);
expand.execute();
you really want to write (pure fiction right now)
ZipUtils.expand(new File(zipfile), new File(destdir));

Ant has already factored out quite some pieces into helper classes, take a look at FileUtils with copyFile and renameFile for example. There certainly is more we could move around into pieces independent of Ant and I expect this to happen when we create more antlibs.

So far I don't sense any resistance against moving code into helper classes, but you must understand this is not a first-class concern for Ant. Ant can reuse Ant quite well ;-)

If you want to reuse a piece of code from Ant and think it is not accessible enough, I wouldn't expect us to reject your patches. The only thing you need to be aware of is that Ant's holy grail of backwards-compatibility applies to the public Java APIs as well, so please don't break them. Join dev@ant and tell us about your ideas.

path: /en/Apache/Ant | #