property

Tag: property

Defines an Ivy variable.

(since 1.3) The optional override attribute enables you to avoid overriding the previous value of the variable, which makes the definition to behave like an Ant property, which is particularly useful to define default values (values which are used only if they haven’t been defined yet).

Attributes

Attribute Description Required

name

the name of the variable to define

Yes

value

the new value the variable must take

Yes

override

true if the previous value (if any) of the variable should overridden, false otherwise

No, defaults to true

ifset

the variable will be set only if the provided 'ifset' variable is already set (since 2.4)

No

unlessset

the variable will not be set unless the provided 'unlessset' variable is set (since 2.4)

No

Examples

<property name="myvar" value="myvalue"/>

Sets the variable myvar to the value myvalue.


<property name="myvar" value="myvalue" override="false"/>

Sets the variable myvar to the value myvalue only if myvar has not been set yet.


 <properties environment="env"/>
 <property name="ivy.repos.server" value="${env.IVY_SERVER}" override="false" ifset="env.IVY_SERVER"/>
 <property name="ivy.repos.server" value="http://ivy:8081" override="false"/>

If the environment variable is set, it takes precedence over of default value.