# Settings Files

In order to work as you want, ivy sometimes needs some settings. Actually, ivy can work with no specific settings at all, see the default settings documentation for details about that. But ivy is able to work in very different contexts. You just have to configure it properly.
Settings are specified through an xml file, usually called ivysettings.xml. To configure ivy from ant, you just have to use the settings datatype with the path of your settings file.
Here is an example of the settings file:

    <ivysettings>
            <properties file="${ivy.settings.dir}/ivysettings-file.properties" />
            <settings defaultResolver="ibiblio" />
            <caches  defaultCacheDir="${cache.dir}" checkUpToDate="false" />
            <resolvers>
                    <ibiblio name="ibiblio" />
                    <filesystem name="internal">
                            <ivy pattern="${repository.dir}/[module]/ivy-[revision].xml" />
                            <artifact pattern="${repository.dir}/[module]/[artifact]-[revision].[ext]" />
                    </filesystem>
            </resolvers>
            <modules>
                    <module organisation="jayasoft" name=".*" resolver="internal" />
            </modules>
    </ivysettings>

Mainly, the settings enable you to configure the default cache directory used by ivy and the dependency resolvers that it will use to resolve dependencies.
Note: To work, this settings file needs a property file named ivysettings-file.properties in the same directory as the settings file, with ivy variables you want in it.
Some useful variables are available in settings files:

- ivy.settings.dir
this variable references the directory in which the ivysettings itself is. This is available if the settings has been loaded as a file. In case of a URL, it takes the part before the last slash of the URL, if any. If the URL has no slash, then this variable is not set.
- ivy.settings.file
the path of the settings file itself if it has been loaded as a file only. If it has been loaded as a URL, this variable is not set
- ivy.settings.url
the URL pointing to the settings file. This is set both when it has been loaded as a file or a URL

since 1.4 Note that all java system properties are available as ivy variables in your settings file.

# Settings file structure

The settings file is structured in some parts and left open in others. Indeed, each resolver has its own structure, thus it's not the settings file itself which defines the structure for the resolvers.

    ivysettings
        property
        properties
        settings
        include
        classpath
        typedef
        credentials
        lock-strategies
        caches
            cache
        latest-strategies
        version-matchers
        triggers
        parsers
        conflict-managers
        outputters
        namespaces
            namespace
                rule
                    fromsystem
                        src
                        dest
                    tosystem
                        src
                        dest
        macrodef
            attribute
            any resolver
        resolvers
            any resolver
        modules
            module
        statuses
            status

# ivysettings

Tag: ivysettings
Root tag of any ivysettings file.

## Child elements

Element | Description | Cardinality
--- | --- | ---
property | set an ivy variable | 0..n
properties | loads a properties file as ivy variables | 0..n
settings | configures ivy with some defaults | 0..1
include | includes another settings file | 0..n
classpath | add a location in the classpath used to load plugins | 0..n
typedef | defines new types in ivy | 0..n
lock-strategies | defines lock strategies | 0..1
caches | defines repository cache managers | 0..1
latest-strategies | defines latest strategies | 0..1
parsers | defines module descriptor parsers | 0..1
version-matchers | defines new version matchers | 0..1
triggers | register triggers on ivy events | 0..1
namespaces | defines new namespaces | 0..1
macrodef | defines a new macro resolver | 0..n
resolvers | defines dependency resolvers | 0..1
conflict-managers | defines conflicts managers | 0..1
modules | defines rules between modules and dependency resolvers | 0..1
outputters | defines the list of available report outputters | 0..1
statuses | defines the list of available statuses | 0..1