ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wayne Stidolph <wa...@lutris.com>
Subject optionally overriding properties?
Date Tue, 16 Oct 2001 00:35:35 GMT
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


Mime
View raw message