> From: Stefan Bodewig [mailto:[EMAIL PROTECTED] > On Fri, 22 Oct 2004, Jan Materne <[EMAIL PROTECTED]> wrote: > > A non usual way is checking for the existing of special classes. So > > you 'only' have to check which classes were added in a release and > > you could check for them. > > It might help to have a concrete example ;-) > > <available property="Ant-1.5.2-or-later" > classname="org.apache.tools.ant.types.ResourceFactory"/> > <fail message="You must use Ant 1.5.2 or later" > unless="Ant-1.5.2-or-later"/>
I've had similar issues in the past, and didn't find a good solution. This is why I advocated to have a version attribute on <project>. The problem is that if you have a script that uses Ant 1.6+ tasks with new attributes compared to their equivalent in 1.5, the build will never reach the <available>+<fail>. It will fail at parsing time, before any task gets to execute. That's because Ant 1.5, unlike 1.6, instantiate some tasks at parsing time, and others later on, while Ant 1.6 does them all later on, the first time there's used. Furthermore, Ant 1.5 does not allow arbitrary task at top level, so the <available>+<fail> must be within a target, complicating the logic of the script. And Jan's <scriptdef> is Ant 1.6+ specific of course. So no, there's no clean and safe way to do this, short of writing your own main() for Ant, or implementing a custom ProjectHelper... Ant should have had a version attribute long ago. --DD --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
