I was messing with a classpath that was built from properties, and suddenly had the thought that it would be nice if the properties for the jar files were only set if they existed (did I type in the right path to the jar? did I move a jar and break my build without realizing it?). I figured I could echo the classpath and see if I was missing something since the unset property would come up blank. So I looked up the Available task in the docs, and replaced a couple properties. I don't see anything in the documentation that says I can't do this.

Yet here is what I get:

Buildfile: build.xml

BUILD FAILED
build.xml:13: Unexpected element "available"

Total time: 3 seconds

I poked around a bit couldn't find anything wrong... printed the version of Ant with the build.sh I had made to make sure I didn't have ANT_HOME screwed up, and such and everything seems fine. After looking at other files that use availabe, it seems that available only appears inside of <target> but not outside. When I tested it, this appeared to be the root of the problem.

There is nothing in the documentation that indicates that some tasks (such as property) can occur outside of targets while others (like available) must be contained in targets. Such a restriction seems potentially reasonable, but it should be documented if it is there. If you contrast the documentation about Property and Available, you get no indication of this difference, and there is no reference to it in using.html.

So my questions are:

Is the behavior I observed likely to be a problem with my setup?
If not, is it a bug in parsing the build.xml or in available?
If this is the intended behavior, should I start a bug requesting that it be documented?


I don't see any reason why available should be restricted to targets anyway, at least not when it is checking for file existance.

Of course I can put it in an init task or something but shouldn't this be documented? How do I find out what other tasks can appear outside of targets?

Gus
(I did a search and found no bugs mentioning available)


-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to