# include

Tag: include

[since 1.3]

Includes another Ivy settings file as if it were part of this one.

The included Ivy settings file has to be a complete well formed Ivy settings file, i.e. it does have to include the `<ivysettings>` tag.

## Attributes

Attribute | Description | Required
--- | --- | ---
url | a URL to the Ivy settings file to include | Yes, unless file is specified
file | a path to the Ivy settings file to include | Yes, unless url is specified
optional | indicates whether Ivy should throw an error if the specified file doesn’t exist (since 2.4). | No, default to false

## Examples

    <ivysettings>
      <property name="myrepository" value="path/to/my/real/rep"/>
      <settings defaultResolver="default"/>
      <include file="path/to/ivysettings-default.xml"/>
    </ivysettings>

with ivysettings-default.xml:

    <ivysettings>
      <property name="myrepository" value="path/to/rep" overwrite="false"/>
      <resolvers>
        <ivyrep name="default" ivyroot="${myrepository}"/>
      </resolvers>
    </ivysettings>

The included Ivy settings defines a resolver named default, which is an ivyrep resolver, with its root configured as being the value of myrepository variable. This variable is given the value `path/to/rep` in the included file, but because the attribute overwrite is set to false, it will not override the value given in the main Ivy settings including this one, so the value used for myrepository will be `path/to/my/real/rep`.

    <ivysettings>
      <include file="ivysettings-macro.xml"/>
      <resolvers>
        <mymacro name="includeworks" mymainrep="included/myrep" mysecondrep="included/secondrep"/>
      </resolvers>
    </ivysettings>

with ivysettings-macro.xml being the Ivy settings example given on the macrodef documentation page. This lets us easily reuse the custom macro resolver.