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>

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.

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.

Some useful variables are available for use in settings files:

  • ivy.settings.dir
    this variable references the directory in which the settings file 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. In fact, each resolver has its own structure, thus it’s not the settings file itself which defines the structure for the resolvers.

ivysettings

ivysettings

Tag: ivysettings

Root tag of any Ivy settings 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

namespaces

defines new namespaces

0..1

macrodef

defines a new macro resolver

0..n

resolvers

defines dependency resolvers

0..1

conflict-managers

defines conflict 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

triggers

register triggers on Ivy events

0..1

version-matchers

defines new version matchers

0..1

timeout-constraints

defines the list of available timeout-constraints

0..n