Ivy use is entirely based on what is called ivy files. Ivy files are xml files, usually called ivy.xml, containing the description of the dependencies of a module, its published artifacts and its configurations.
Here is the simplest ivy file you can write:
<ivy-module version="1.3">
<info organisation="myorg"
module="mymodule"
/>
</ivy-module>
Since version 0.8, ivy publishes an xslt which help make ivy files more readable. You just have to add
a line like this one in your ivy file:
<?xml-stylesheet type="text/xsl" href="http://www.ivyrep.org/ivy-doc.xsl"?>
However, all information is not presented with the xslt (dependency configurations, in particular).
And due to security issues, it only works if the ivy file is in the same domain as the xsl... But they are particularly useful to browse the ivy repository.
If you want to see a sample file using almost all possibilities of ivy files, check this one, with or without xslt.
Before beginning the reference itself, it is required to have in mind the terminology defined in the main page of this reference documentation.
For those familiar with xml schema, the schema used to validate ivy files can be found here. For those using xsd aware IDE, you can declare the xsd in your ivy files to benefit from code completion / validation:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.jayasoft.org/misc/ivy/ivy.xsd">
<info organisation="myorg"
module="mymodule"
/>
</ivy-module>
ivy-module info license ivyauthor repository description configurations conf publications artifact conf dependencies dependency conf mapped artifact conf include conf exclude conf conflicts manager
Tag: ivy-module
Root tag of any ivy-file.
Attribute | Description | Required |
---|---|---|
version | the version of the ivy file specification - should be '1.3' with current version of ivy | Yes |
Element | Description | Cardinality |
---|---|---|
info | contains information about the described module | 1 |
configurations | container for configuration elements | 0..1 |
publications | container for published artifact elements | 0..1 |
dependencies | container for dependency elements | 0..1 |
conflicts | section to configure the conflict managers to use | 0..1 |
Tag: info Parent: ivy-module
Gives information about the module this ivy file describe.
since 1.4 This tag supports extra attributes.
Attribute | Description | Required |
---|---|---|
organisation | the name of the organisation that is the owner of this module. | Yes |
module | the name of the module described by this ivy file. | Yes |
branch | the branch of this module. since 1.4 | No, defaults to the default branch configured, or nothing if no default branch is configured |
revision | the revision of this module. | Yes in repository ivy files, no in ivy files to resolve |
status | the status of this module. See terminology section for details | No, default to 'integration' |
publication | the date of publication of this module. It should be given in this format: yyyyMMddHHmmss | No, but it's a good practice to set it with delivered ivy files |
Element | Description | Cardinality |
---|---|---|
license | contains information about the licenses of the described module | 0..n |
ivyauthor | describes who has contributed to write the ivy file | 0..n |
repository | describes on which public repositories this module can be found | 0..n |
description | describes how to use the module | 0..1 |
Attribute | Description | Required |
---|---|---|
name | the name of the license. Try to respect spelling when using a classical license. | Yes |
url | an url pointing to the license text. | No, but it's a good practice to indicate it |
Attribute | Description | Required |
---|---|---|
name | the name of the author, as a person or a company. | Yes |
url | an url pointing to where the author can bea reached. | No, but it's a good practice to indicate it |
Attribute | Description | Required |
---|---|---|
name | the name of the repository. Try to respect spelling for common repositories (ibiblio, ivyrep, ...) | Yes |
url | an url pointing to the repository. | Yes |
pattern | an ivy pattern to find modules on this repository | No, but it's recommended to indicate it. |
ivys | true if ivy file can be found on this repository | No, defaults to false. |
artifacts | true if module artifacts can be found on this repository | No, defaults to false. |
Attribute | Description | Required |
---|---|---|
homepage | the url of the homepage of the module | No, but it's recommended to indicate it. |
Tag: configurations Parent: ivy-module
Container for configuration element. If this container is not present, it is assumed that the module has one public configuration called 'default'.
since 1.3 You can define a new default conf mapping on this container by specifying the defaultconfmapping attribute.
A default conf mapping is very similar to the defaultconf which can be set on the dependencies tag, but it has a slightly different behaviour.
The default conf mapping not only defines the conf mapping to use when no conf mapping is specified for a dependency in this ivy file, but it also modify the way ivy interprets conf mapping with no mapped conf. In this case, Ivy will look in the default conf mapping and use the conf mapping defined in the default conf mapping for the conf for which there is no mapped conf.
See examples on the dependency page.
since 1.4 You can activate a confmappingoverride mode for all configurations, in which case the extending configurations will override the mappings of the configurations they extend from. This is an advanced feature which should be used only if you understand its implication.
For a discussion about the origin of this feature see this thread.
Attribute | Description | Required |
---|---|---|
defaultconfmapping | the default conf mapping to use in this ivy file since 1.3 | No, defaults to no default conf mapping |
confmappingoverride | true to activate configuration mapping override, false otherwise since 1.4 | No, defaults to false |
Element | Description | Cardinality |
---|---|---|
conf | declares a configuration of this module | 0..n |
include | include configurations from another file | 0..n |
Tag: conf Parent: configurations
Declares a configuration of this module. As described in the reference page, a configuration is a way to use or construct a module. Some modules may be used in different ways (think about hibernate which can be used inside or outside an application server), and this way may alter the artifacts you need (in the case of hibernate, jta.jar is needed only if it is used outside an application server). Moreover, a module may need some other modules and artifacts only at build time, and some others at runtime. All those differents ways to use or build a module are called in ivy configurations.
The conf element in the configurations section declares one configuration. This declaration gives the name of the configuration declared, its visibility and the other configurations of the module it extends.
Visibility is used to indicate whether or not a configuration can be used from other modules depending on this one. Thus a private configuration is only used for internal purpose (maybe at build time), and other modules cannot declare to depend on it.
A configuration can also extend one or several other ones of the same module. When a configuration extends another one, then all artifacts required in the extended configuration will also be required in the configuration that extends the other one. For instance, if configuration B extends configuration A, and if artifacts art1 and art2 are required in configuration A, then they will be automatically required in configuration B. On the other hand, artifacts required in configuration B are not necessarily required in configuration A.
This notion is very helpful to define configurations which are similar with some differences.
since 1.4 The extends attribute can use the following wildcards:
* | all other configurations |
*(public) | all other public configurations |
*(private) | all other private configurations |
since 1.4 A whole configuration can be declared as non transitive, so that all dependencies resolved in this configuration will be resolved with transitivity disabled. Note that the transitivity is disabled for all the configuration dependencies (including those obtained because this conf extends other ones), and only for this configuration (which means that a conf extending this one with transitivityy enabled will get transitive dependencies even for dependencies being part of the non transitive configuration).
This is very useful to build a compile configuration, for instance, forcing the dependency declaration on each direct dependency, with no risk to forget some because of transitivity.
since 1.4 This tag supports extra attributes.
Attribute | Description | Required |
---|---|---|
name | the name of the declared configuration | Yes |
description | a description for the declared configuration | No |
visibility | the visibility of the declared configuration. 'public' means that this configuration can be used by other modules, while 'private' means that this configuration is used only in the module itself, and is not exposed to other modules |
No, defaults to public |
extends | a comma separated list of configurations of this module that the current configuration extends |
No, defaults to none |
transitive | a boolean to indicate if this conf is transitive or not since 1.4 | No, defaults to true |
deprecated | indicates that this conf has been deprecated by giving the date of the deprecation. It should be given in this format: yyyyMMddHHmmss |
No, by default the conf is not deprecated |
<conf name="core" visibility="private" />
<conf name="compile" extends="core" transitive="false" visibility="private" />
<conf name="runtime" extends="compile" description="everything needed to run this module" />
Declares three configurations, core compile and runtime, with only the runtime one accessible from other modules, and with the compile one being non transitive.
Therefore the core configuration will only be composed of dependencies declared in the core configuration itself, the compile configuration will be composed of all dependencies required in either core or compile configuration, but without transivity (neither for core nor compile dependencies), and runtime will be composed of all dependencies, all transitively, including the dependencies declared only in compile.
Tag: include Parent: configurations
Include configurations specified in another file. since 1.3
The included file should have a configurations tag as root tag, which follow the same specification as the configurations tag of the ivy file.
This means that it can contain conf declarations, other file inclusion, and also a defaultconfmapping.
When delivering an ivy file with such an inclusion, the included configuration file is inlined, i.e. ivy remove the dependency on the external file.
Attribute | Description | Required |
---|---|---|
file | the file to include | Yes |
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
/>
<configurations>
<include file="path/to/included-configurations.xml"/>
<conf name="conf3"/>
</configurations>
<dependencies>
<dependency name="mymodule1" rev="1.0"/>
<dependency name="mymodule2" rev="2.0" conf="conf2,conf3->*"/>
</dependencies>
</ivy-module>
with included-configurations.xml like this:
<configurations defaultconfmapping="*->@">
<conf name="conf1" visibility="public"/>
<conf name="conf2" visibility="private"/>
</configurations>
Defines 3 configurations, conf1, conf2 and conf3. mymodule1 is required in each configuration, with for each the same configuration (conf1 is needed in conf1, conf2 in conf2, and conf3 in conf3) due to the defaultconfmapping defined in the included file.
Element | Description | Cardinality |
---|---|---|
artifact | declares a published artifact for this module | 0..n |
Tag: artifact Parent: publications
Declares an artifact published by this module. This is especially useful for other modules dependending on this one. They thus get all published artifacts belonging to the configurations asked. Indeed, each published artifact declares in which public configuration it is published. Thus a module depending on this module only get artifacts marked with the asked configurations, taking into account configurations extension (see configuration declaration).
The configurations in which an artifact is published can be configured in two ways:
The twos are equivalent, it is only a matter of preference. However, do not mix both for one artifact.
since 1.4 The artifact element as default values for all its attributes, so if you want to declare a default artifact you can just declare it like that:
<artifact />
If this is the only artifact declared, then it's equivalent to having no publication section at all.
since 1.4 It is possible to give a url at which artifacts can be found. This is not mandatory, and even not recommended. This is only a convenient way to deal with an existing repository with a bad layout, but should not be avoided in an enterprise repository.
Attribute | Description | Required |
---|---|---|
name | the name of the published artifact. This name must not include revision. | No, defaults to the name of the module |
type | the type of the published artifact. It's usually its extension, but not necessarily. For instance, ivy files are of type 'ivy' but have 'xml' extension | No, defaults to jar |
ext | the extension of the published artifact | No, defaults to type |
conf | comma separated list of public configurations in which this artifact is published. '*' wildcard can be used to designate all public configurations of this module |
No, defaults to '*' if neither conf attribute nor conf children element is given |
url | a url at which this artifact can be found if it isn't located at the standard location in the repository since 1.4 | No, defaults to no url |
Element | Description | Cardinality |
---|---|---|
conf | indicates a public configuration in which this artifact is published | 0..n |
<artifact />
Declares an artifact with the name of the module as name, type and ext jar, and published in all configurations.
<artifact name="foo-src" type="source" ext="zip" conf="src" />
Declares an artifact foo-src, of type 'source' with extension 'zip', and published in the src configuration.
<artifact name="foo" url="http://www.acme.com/repository/barbaz/foo-1.2-bar.jar" />
Declares an artifact foo, of type and extension 'jar' located at the url http://www.acme.com/repository/barbaz/foo-1.2-bar.jar
. This url will only be used if the artifact cannot be found at its standard location.
Attribute | Description | Required |
---|---|---|
name | the name of the module public configuration in which this artifact is published. '*' wildcard can be used to designate all public configurations of this module | Yes |
Tag: dependencies Parent: ivy-module
Container for dependency elements, used to describe the dependencies of this module.
If this container is not present, it is assumed that the module has no dependency at all.
This container let the possibility to defines two very similar things: defaultconf and defaultconfmapping.
defaultconf
exists since Ivy 1.1 and enables to define the default conf attribute to use when no conf is defined for a dependency in this ivy file. It is only used when no conf mapping is defined, and has no influence in other cases.
defaultconfmapping
exists since Ivy 1.3 and enables not only to define the default conf mapping when no conf is specified for a dependency in this ivy file, but it also influence the way conf mapping with no mapped conf are interpreted (see configurations doc page for details about this).
Note that if both defaultconf and defaultconfmapping are defined, it's the defaultconfmapping that is used. Note also that if several defaultconfmapping are defined (one in the configurations tag, one or several in included configurations file, and/or one in the dependency tag, then it's only the last which is taken into account, the others will have no effect at all.
Attribute | Description | Required |
---|---|---|
defaultconf | the default configuration to use when none is specified in a dependency. since 1.1 | No, defaults to *->* |
defaultconfmapping | the default configuration mapping to use in this ivy fie. since 1.3 | No, defaults to no default conf mapping |
Element | Description | Cardinality |
---|---|---|
dependency | declares a dependency for this module | 0..n |
Tag: dependency Parent: dependencies
Declares a dependency for this module. A dependency is described by the module on which the current module depends (identified by its name, organisation and revision), and a mapping of configurations.
The revision can be given as a fixed one (1.5.2, for instance) or as a latest (or dynamic) one. Several possibilities for dynamic revisions are implemented in Ivy:
selects the latest revision of the dependency module.
selects the latest revision of the dependency module with at least the specified status. since 1.4
For instance latest.milestone will select the latest version being either a milestone or a release, and latest.release will only selects the latest release. Note that in order to find the latest revision with the appropriate status Ivy has to parse all the ivy files in your repository from the last one until it finds such a revision. Hence don't be surprised if the resolution slow down.
See also statuses to see how to configure module statuses.
selects the latest sub-revision of the dependency module. For instance,
if the dependency module exists in revision 1.0.3, 1.0.7 and 1.1.2, "1.0.+" will select 1.0.7.
mathematical notation for ranges can be used to match a range of version. since 1.4
Examples:
[1.0,2.0] matches all versions greater or equal to 1.0 and lower or equal to 2.0
[1.0,2.0[ matches all versions greater or equal to 1.0 and lower than 2.0
]1.0,2.0] matches all versions greater than 1.0 and lower or equal to 2.0
]1.0,2.0[ matches all versions greater than 1.0 and lower than 2.0
[1.0,) matches all versions greater or equal to 1.0
]1.0,) matches all versions greater than 1.0
(,2.0] matches all versions lower or equal to 2.0
(,2.0[ matches all versions lower than 2.0
since 1.4 If you don't find a way to expression your dependency version constraint among these, you can plug your own.
The way to determine which revision is the "latest" between two is configurable through the use of pluggable LatestStrategy. See ivy main concepts for details about this.
This mapping indicates which configurations of the dependency are required in which configurations of the current module, also called master configurations.
There are several ways to declare this mapping of configurations, choose depending more on preference than on possibilities. Try to avoid mixing usage in a single dependency element: do not use both nested and inline mapping declaration.
The first way to declare this mapping is called the inline mapping. It is maybe the less natural at first, but it's powerful and concise. Inline mapping can take several forms.
This means that in this master configuration the same dependency configuration is needed (except if a defaultconfmapping has been specified in this ivy file, see configurations for details, or table below for examples).
For instance, if the current module has defined a configuration named 'runtime', and the dependency too, then having an inline mapping configuration set to 'runtime' means that in the runtime master configuration the runtime dependency configuration is required.
More examples:
The table below indicates how ivy interpret the conf attribute according to how defaultconfmapping is set:
defaultconfmapping | conf | ivy interpretation |
---|---|---|
*->* |
||
runtime | runtime->runtime |
|
test | test->test |
|
runtime->*;test->default |
runtime->*;test->default |
|
runtime->*;test->default |
runtime | runtime->* |
runtime->*;test->default |
test | test->default |
A good way to remember which side is for the master configuration (i.e. the configuration of the module defining the dependency) and which side is for the dependency configuration is to read the '->' as 'depends on'.
In this case, all specified dependency configurations are required in all specified master configurations.
For instance, 'A, B, C -> E, F' means that dependency configurations E & F are required in master configurations A, B and C.
Note that you can use the wildcard '*' as a configuration name, meaning that all configurations (either master or dependency public ones depending on the side) are wanted. For instance, '* -> B, C' means that B & C dependency configurations are required in all master configurations.
since 1.4 you can use * wildcard followed by negated configurations to mean all but xxx. For instance, '*, !A, !B -> X' means that X dependency configuration is required in all master configurations except A and B.
since 1.2 '@' also has a special meaning as a right operand of the dependency mapping, it means map to self. This is particularly useful with '*', '*->@' meaning that all configurations of the module maps to their equivalent (same name) in the dependency.
since 1.4 '#' can be used as right side operand to mean 'this' configuration, and thus refers to the configuration being resolved. It is slightly similar to @, except that it takes into account the configuration being actually resolved in case of a configuration extending another one.
Example:
Let's foo be a module with two configurations, A and B, B extending A.
Then a dependency declaring conf A-># will get A dep conf in its confs A (when resolving A, ivy will find interpret the # symbol as A) and B dep conf in its conf B (when resolving B, ivy will interpret the # symbol as B, even if this dependency is only required because of the A dependency).
See this thread on the forum for a more detailed motivation behind this keyword.
If you don't understand really how this works, do not use :-)
since 1.4 '%' can be used as left side operand to mean 'all the other configurations'. This can be usefull when you only have a specific mapping for some configurations and a default mapping for all the others.
Example:
test->runtime;%->default
means that the test
configuration is mapped to the runtime
configuration, but all the other configurations are mapped to the default
configuration.
since 1.3 a fallback mechanism can be used when you are not sure that the dependency will have the required conf. You can indicate to ivy that you want one configuration, but if it isn't present, use another one.
The syntax for specifying this adds the fallback conf between parenthesis right after the required conf.
For instance, test->runtime(default)
means that in the test configuration of the module the runtime
conf of the dependency is required, but if doesn't exist, it will use the default
conf instead. If default
conf doesn't exist then it will be considered as an error. Note that the *
wildcard can be used as fallback conf.
since 1.4 you can add simple conditions in the dependency mapping. This is done by adding a condition between '[' and ']'. If the condition evaluates to true
, the mapping is performed. If the condition evaluates to false
, the mapping will be ignored. For instance, test->[org=A]runtime,[org=B]default
means that the test
configuration will be mapped to the runtime
conf for the dependencies of organisation 'A' and to the default
conf for dependencies of organisation 'B'.
In this case, it is the union of the mapping which is kept. For instance, 'A -> B; * -> C' means that B conf is needed in A conf and C conf is need in all master conf... so both B & C dep conf are required in A master conf
If you prefer more verbose mapping declaration, everything is also possible with sub elements mapping declaration.
Moreover, the dependency element also supports an artifact restriction feature (since 0.6).
See dependency artifact restriction for details.
Finally, the dependency element also supports an a force attribute (since 0.8), which gives an indication
to conflicts manager to force the revision of a dependency to the one given here.
See conflicts manager for details.
since 1.4 this tag supports extra attributes
Attribute | Description | Required |
---|---|---|
org | the name of the organisation of the dependency. | No, defaults to the master module organisation |
name | the module name of the dependency | Yes |
branch | the branch of the dependency. since 1.4 | No, defaults to the default branch configured for the dependency. |
rev | the revision of the dependency. See above for details. | Yes |
force | a boolean to give an indication to conflict manager that this dependency should be forced to this revision (see conflicts manager) |
No, defaults to false |
conf | an inline mapping configuration spec (see above for details) | No, defaults to defaultconf attribute of dependencies element if neither conf attribute nor conf children element is given |
transitive | true to resolve this dependency transitively, false otherwise (since 1.2) | No, defaults to true |
changing | true if the dependency artifacts may change without revision change, false otherwise (since 1.2). Artifacts update will be looked after only if the publication date of the ivy file has changed. Note that this is not a recommended use and that it avoid some cache optimization in ivy. | No, defaults to false |
Element | Description | Cardinality |
---|---|---|
conf | defines configuration mapping has sub element | 0..n |
artifact / include | defines artifacts inclusion - use only if you do not control dependency ivy file | 0..n |
exclude | defines artifacts exclusion - use only if you do not control dependency ivy file | 0..n |
<dependency org="jayasoft" name="swtbinding" revision="0.2"/>
Declares a dependency on the module swtbinding from jayasoft in its revision 0.2. All the configuration of this dependency will be included in all configurations of the module in which the dependency is declared.
<dependency org="jayasoft" name="swtbinding" branch="fix-103" revision="latest.integration"/>
Same as above except that it will take the latest revision on the branch 'fix-103' instead of revision '0.2'.
<dependency name="mymodule" revision="latest.integration" conf="test->default"/>
Declares a dependency on the module mymodule
from the same organisation as the module in which the dependency is declared. The latest available revision of this dependency will be used. This dependency will only be included in the test configuration of the module, and it's only the default configuration of the dependency which will be included.
<dependency org="apache" name="commons-lang" revision="2.0" force="true" conf="default"/>
Declares a dependency on the module commons-lang
from apache, in revision 2.0. The revision 2.0 will be used even if another dependency declares itself a dependency on another version of commons-lang. Moreover, if no defaultconfmapping is defined, only the default
conf of commons-lang will be used in the default
conf of the master module. If *->runtime
was declared as defaultconfmapping, then the runtime conf of commons-lang would be included in the default conf of the master module. Note that whatever the defaultconfmapping is, the dependency only be included in the default conf of the master module. The defaultconfmapping only changes the required dependency confs.
<dependency org="foo" name="bar" revision="3.0" transitive="false" conf="default->@;runtime,test->runtime"/>
Declares a dependency on the module bar
from foo, in revision 3.0. The dependencies of bar will themselves not be included due to the setting of transitive. The default dependency conf will be included in the default master conf, and the runtime dependency conf will be included in both the runtime and test master conf.
<dependency org="foo" name="bar" revision="3.0" changing="true" conf="compile->runtime(default)"/>
Declares a dependency on the module bar
from foo, in revision 3.0. This revision is considered to be able to change (changing="true"
), so even if it is already in ivy cache, Ivy will check if a revision is a more recent last modified date is available on the repository. The runtime conf of bar is required in the compile conf of the master module, but if bar doesn't define a runtime conf, then the default
conf will be used.
Attribute | Description | Required |
---|---|---|
name | the name of the master configuration to map. '*' wildcard can be used to designate all configurations of this module | Yes |
mapped | a comma separated list of dependency configurations to which this master configuration should be mapped | No, default to the same configuration as master one, unless nested mapped elements are specified |
Element | Description | Cardinality |
---|---|---|
mapped | map dependency configurations for this master configuration | 0..n |
Attribute | Description | Required |
---|---|---|
name | the name of the dependency configuration mapped. '*' wildcard can be used to designate all configurations of this module | Yes |
Tag: artifact Parent: dependency
This feature gives you more control on a dependency for which you do not control its ivy file.
It enables to specify the artifacts required, if the dependency has no ivy file.
Indeed, when a module has no ivy file, it is assumed that it publishes exactly one artifact having the same name as the module itself. But when this module publishes more artifacts, or simply does not respect the name rule, and if you cannot deliver an ivy file for it (because you do not control the repository, for instance - think about maven ibiblio repository, to give no name), then this feature let you specify the artifacts names you want to get.
Each artifact specification can be given in the context of particular master configurations. By default, if no configuration is specified, artifacts specification apply to all master configurations. But you can specify that a specification applies only to one or several master configurations, using either inline or nested conf specification. In this case, do not forget that if you do not specify any specification for a particular configuration, then no specification will apply for this configuration and it will be resolved not taking into account any specification.
For instance, imagine you have A, B & C master configurations. If you specify art1 in A & B and art2 in A, then C will not be specified at all, and will thus assume the default artifact. To prevent this, you have to specify a configuration mapping for the dependency, mapping only A & B to some or all dependency configurations.
Example:
<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="A,B->default">
<artifact name="art1" type="jar" conf="A,B"/>
<artifact name="art2" type="jar" conf="A"/>
</dependency>
since 1.4 It's possible to indicate the url at which the artifact can be found. This is not mandatory, and even not recommended with an enterprise repository. Note that Ivy will always look at the location where the artifact should be and only use th url if it cannot be found at the standard location in the repository.
Attribute | Description | Required |
---|---|---|
name | the name of an artifact of the dependency module | Yes |
type | the type of the artifact of the dependency module | Yes |
ext | the extension of the artifact of the dependency module | No, defaults to type |
conf | comma separated list of the master configurations in which this artifact should be included. '*' wildcard can be used to designate all configurations of this module |
No, defaults to '*', unless nested conf are specified |
url | an url where this artifact can be found if it isn't present at the standard location in the repository since 1.4 | No, defaults to no url |
Element | Description | Cardinality |
---|---|---|
conf | configuration in which the artifact should be included | 0..n |
<dependency org="foo" name="bar" rev="1.0">
<artifact name="baz" type="jar"/>
</dependency>
Declares a dependency on module bar which only publish one artifact: baz.jar.
<dependency org="foo" name="bar" rev="1.0">
<artifact name="baz" type="jar" url="http://www.acme.com/repository/bar/baz-1.0-acme.jar"/>
</dependency>
Same as above, except that if the artifact is not found at its standard location, Ivy will use http://www.acme.com/repository/bar/baz-1.0-acme.jar
to download it.
Tag: conf Parent: artifact
Specify a configuration in which the enclosing artifact specification should be included.
Attribute | Description | Required |
---|---|---|
name | the name of the master configuration in which the enclosing artifact should be included | Yes |
Tag: exclude Parent: dependency
This feature gives you more control on a dependency for which you do not control its ivy file.
It enables to restrict the artifacts required, by excluding artifacts being published by the dependency or any of its transitive dependencies,
even if configuration does not a good separation of published artifacts
The same principle concerning configuration as for include applies to this exclude feature (see above the include feature).
Note that exclusion is always done AFTER inclusion has been done.
since 1.3 This exclude feature can also be used not only to exclude artifacts but also to exclude whole modules. Indeed when you exclude artifacts, it doesn't avoid ivy to search for the module itself, and to resolve the dependencies of the module. But you can also exclude the whole module, which means that the module will not be downloaded at all, and so its own dependencies will not be resolved. For sure, this is usually done to exclude not a direct dependency but an indirect one. To exclude a whole module, you just have to not specify any artifact name, type and ext in your exclude rule. For instance:
<dependency name="A" rev="1.0">
<exclude module="B"/>
</dependency>
Attribute | Description | Required |
---|---|---|
org | the organisation of the dependency module or artifact to exclude, or a regexp matching this organisation since 1.3 | No, defaults to * |
module | the name of the dependency module or the artifact to exclude, or a regexp matching this module name since 1.3 | No, defaults to * |
name | the name of an artifact of the dependency module to add to the exclude list, or a regexp matching this name | No, defaults to * |
type | the type of the artifact of the dependency module to add to the exclude list, or a regexp matching this name | No, defaults to * |
ext | the extension of the artifact of the dependency module to add to the exclude list, or a regexp matching this name | No, defaults to type |
matcher | the matcher to use to match the modules to excludes since 1.3 | No, defaults to exactOrRegexp in pre 1.3 ivy files, and exact in 1.3 and superior |
conf | comma separated list of the master configurations in which this artifact should be included. '*' wildcard can be used to designate all configurations of this module |
No, defaults to '*', unless nested conf are specified |
Element | Description | Cardinality |
---|---|---|
conf | configuration in which the artifact should be included | 0..n |
Attribute | Description | Required |
---|---|---|
name | the name of the master configuration in which the enclosing artifact should be excluded | Yes |
Tag: include Parent: dependency
This feature gives you more control on a dependency for which you do not control its ivy file.
It enables to restrict the artifacts required by including only the artifacts given here, even if configuration does not a good separation of published artifacts.
Each artifact restriction can be given in the context of particular master configurations. By default, if no configuration is specified, artifacts restriction apply to all master configurations. But you can specify that a restriction applies only to one or several master configurations, using either inline or nested conf specification. In this case, do not forget that if you do not specify any restriction for a particular configuration, then no restriction will apply for this configuration and it will be resolved not taking into account any restriction.
For instance, imagine you have A, B & C master configurations. If you restrict to art1 in A & B and art2 in A, then C will not be restricted at all, and will thus get all artifacts of all dependency configurations if you do not specify a configuration mapping. To prevent this, you have to specify a configuration mapping for the dependency, mapping only A & B to some or all dependency configurations.
Example:
<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="A,B->default">
<include name="art1" type="jar" conf="A,B"/>
<include name="art2" type="jar" conf="A"/>
</dependency>
Attribute | Description | Required |
---|---|---|
name | the name of an artifact of the dependency module to add to the include list, or a regexp matching this name | No, defaults to .* |
type | the type of the artifact of the dependency module to add to the include list, or a regexp matching this name | No, defaults to .* |
ext | the extension of the artifact of the dependency module to add to the include list, or a regexp matching this name | No, defaults to type |
conf | comma separated list of the master configurations in which this artifact should be included. '*' wildcard can be used to designate all configurations of this module |
No, defaults to '*', unless nested conf are specified |
Element | Description | Cardinality |
---|---|---|
conf | configuration in which the artifact should be included | 0..n |
Tag: conf Parent: include
Specify a configuration in which the enclosing artifact inclusion should be included.
Attribute | Description | Required |
---|---|---|
name | the name of the master configuration in which the enclosing artifact should be included | Yes |
Element | Description | Cardinality |
---|---|---|
manager | declares a conflict manager for this module | 1..n |
Attribute | Description | Required |
---|---|---|
org | the name, or a regexp matching the name of organisation to which this conflict manager should apply | No, defaults to * (match all) |
module | the name, or a regexp matching the name of module to which this conflict manager should apply | No, defaults to * (match all) |
name | the name of the conflict manager to use | Exactly one of two |
rev | a comma separated list of revisions this conflict manager should select | |
matcher | the matcher to use to match the modules for which the conflict manager should be used since 1.3 | No, defaults to exactOrRegexp in pre 1.3 ivy files, and exact in 1.3 and superior |