blob: 1af4e251f4e4e9ab163280579b5824d9a4cbac9e [file] [log] [blame]
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
= property
*Tag:* property
[ivysettings.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
[options="header",cols="15%,50%,35%"]
|=======
|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
[source, xml]
----
<property name="myvar" value="myvalue"/>
----
Sets the variable myvar to the value myvalue.
'''
[source, xml]
----
<property name="myvar" value="myvalue" override="false"/>
----
Sets the variable myvar to the value myvalue only if myvar has not been set yet.
'''
[source, xml]
----
<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.