ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Matthies <ml_ant-u...@nmhq.net>
Subject Re: Set a default value to property.
Date Tue, 30 Nov 2010 20:00:06 GMT
I don't think this (emitting a warning) was ever the case. Setting and
overriding defaults this way is one of the basic techniques in Ant. It
should probably be made more explicit in the manual.

-- Niklas Matthies


On Tue 2010-11-30 at 14:30h, Scot P. Floess wrote on user:
>
> Actually, nothing at all...  I swear at one time I thought a warning was  
> emitted when doing that...  It was at that time I started using the  
> enclosed macrodef...  Perhaps I am just remembering wrong...
>
> On Tue, 30 Nov 2010, Niklas Matthies wrote:
>
>> How is this different from just
>>
>>    <property name="SomeProperty" value="Some Default Value"/>
>>
>> ?
>>
>> -- Niklas Matthies
>>
>>
>> On Tue 2010-11-30 at 14:11h, Scot P. Floess wrote on user:
>>>
>>> Here is something I like to use...  I macrodef'd it out so I can call it
>>> for many properties that require default values...
>>>
>>>     <macrodef name="default">
>>>         <attribute name="property"/>
>>>         <attribute name="default"/>
>>>         <attribute name="description" default=""/>
>>>
>>>         <sequential>
>>>             <condition property="@{property}" value="@{default}">
>>>                 <not>
>>>                     <isset property="@{name}"/>
>>>                 </not>
>>>             </condition>
>>>         </sequential>
>>>     </macrodef>
>>>
>>> This works with stock Ant (meaning you don't need Ant-contrib or any
>>> third party libraries)...
>>>
>>> To use:
>>>
>>> <default property="SomeProperty" default="Some Default Value"/>
>>>
>>>
>>>
>>> On Tue, 30 Nov 2010, ritchie wrote:
>>>
>>>>
>>>> My ant script takes a value for a property at runtime(-Denv=xxx), if the
>>>> argument is not passed i want the value to be set as a default arbitary
>>>> value. How to accomplish this?
>>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message