Configuration
In order to work as you want, ivy need some configuration. Actually, ivy can work with no configuration at all, see the default configuration documentation for details about that. But ivy is able
to work in very different contexts. You just have to configure it properly.
Configuration is done through an xml file, usually called ivyconf.xml. To configure ivy from ant, you just have to call the configure task and pass it the path to your configuration file (see configure task documentation for details).
Here is an example of configuration file :
<ivyconf>
<properties file="${ivy.conf.dir}/ivyconf-file.properties" />
<conf defaultCache="${cache.dir}" defaultResolver="ibiblio" 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>
</ivyconf>
Mainly, the configuration enables to configure the default cache directory used by ivy and the dependency resolvers that it will use to resolve dependencies.
Note: To work, this configuration file needs a property file named ivyconf-file.properties in the same directory as the configuration file, with ivy variables you want in it.
Some useful variables are available in ivyconf files:
- ivy.conf.dir
- ivy.conf.file
- ivy.conf.url
this variable references the directory in which the ivyconf itself is. This is available if the ivyconf has been loaded as a file. In case of an 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.
the path of the ivyconf file itself, it has been loaded as a file only. If it has been loaded as an url, this variable is not set
the url pointing to the ivyconf file. This is set both when it has been loaded as a file or an url
since 1.4 Note that all java system properties are available as ivy variables in your configuration file.
Configuration file structure
The configuration file is structured in some parts and left other open. Indeed each resolver has its own
structure, thus it's not the configuration file itself which define the structure for the resolvers.
ivyconf
property
properties
conf
include
classpath
typedef
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
ivyconf
Tag: ivyconf
Root tag of any ivyconf file.
Child elements
| Element | Description | Cardinality |
|---|---|---|
| property | set an ivy variable | 0..n |
| properties | loads a properties file as ivy variables | 0..n |
| conf | configures ivy with some defaults | 0..1 |
| include | includes another ivyconf file | 0..n |
| classpath | add a location in the classpath used to load plugins | 0..n |
| typedef | defines new types in ivy | 0..n |
| 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 |
