ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <>
Subject Re: Set a default value to property.
Date Tue, 30 Nov 2010 19:11:45 GMT

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=""/>

             <condition property="@{property}" value="@{default}">
                     <isset property="@{name}"/>

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?

Scot P. Floess

RHCT  (Certificate Number 605010084735240)

Chief Architect FlossWare

Chief Architect JPlate
Chief Architect JavaPIM
Chief Architect Keros

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message