You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Wayne Stidolph <wa...@lutris.com> on 2001/10/16 02:35:35 UTC
optionally overriding properties?
I've tried to RTFM, and search the archives, but I haven't found a good
technique yet... is there a general mechanism to let me provide
attribute values to tasks when I have a value I want used, but to not
supply the attribute at all if I don't have a specific value? What I
want to do is some thing like:
<target name="foo">
<property file="sometarget.properties" />
<sometarget
attribute1="${a.value} />
such that if there is no property "a.value" then it is as if the line
"attribute1=..." was never in the build file (so attribute1 can get its
default value).
What I'm doing now is explicitly listing every attribute and their
default values in my foo.properties file, and passing all those
properties explicitly. This is a *real* ugly mess just to get optional
override. And it's very awkward to figure out what the defaults *are*
since many of the task javadocs don't state what the default is
(particularly for non-required properties). So, I'm reading code ... but
then I will have a maintenance problem in this tight coupling of the
properties files to the tasks. And, some tasks don't *like* having the
properties all set (for example, setting 'dir' on JUnit when not forking
causes an extra output message)
So, my current approach is not good. Is there a better way - something
obvious I'm missing?
Wayne Stidolph