- Documentation (2.5.0-rc1)
- Release Notes
- Tutorials
- Reference
- Introduction
- Settings Files
- Ivy Files
- Ant Tasks
- artifactproperty
- artifactreport
- buildlist
- buildnumber
- buildobr
- cachefileset
- cachepath
- checkdepsupdate
- cleancache
- configure
- convertmanifest
- convertpom
- deliver
- dependencytree
- findrevision
- fixdeps
- info
- install
- listmodules
- makepom
- post resolve tasks
- publish
- report
- repreport
- resolve
- resources
- retrieve
- settings
- var
- Using standalone
- OSGi
- Developer doc
resolve
The resolve task actually resolves dependencies described in an Ivy file, and puts the resolved dependencies in the Ivy cache. If configure has not been called before resolve is called, a default configuration will be used (equivalent to calling configure without attributes).
After the call to this task, four properties are set in Ant:
-
ivy.organisation
: set to the organisation name found in the Ivy file which was used for resolve -
ivy.module
: set to the module name found in the Ivy file which was used for resolve -
ivy.revision
: set to the revision name found in the Ivy file which was used for resolve, or a generated revision name if no revision was specified in the file -
ivy.resolved.configurations
: set to the comma separated list of configurations resolved
(since 1.2) An additional property is set to true
if the resolved dependencies are changes since the last resolve, and to false
otherwise: ivy.deps.changed
.
(since 2.0) The property ivy.deps.changed
will not be set (and not be computed) if you set the parameter checkIfChanged
to false
. (By default, it is true
to keep backward compatibility). This allows to optimize your build when you have multi-module build with multiple configurations.
(since 2.0) In addition, if the resolveId
attribute has been set, the following properties are set as well:
-
ivy.organisation.${resolveId}
-
ivy.module.${resolveId}
-
ivy.revision.${resolveId}
-
ivy.resolved.configurations.${resolveId}
-
ivy.deps.changed.${resolveId}
(since 2.4) If current module extends other modules:
-
ivy.parents.count
: number of parent modules -
ivy.parent[index].organisation
: set to the organisation name found in the parent Ivy file which was used for resolve -
ivy.parent[index].module
: set to the module name found in the parent Ivy file which was used for resolve -
ivy.parent[index].revision
: set to the revision name found in the parent Ivy file which was used for resolve -
ivy.parent[index].branch
: set to the branch name found in the parent Ivy file which was used for resolve
Where index represent the index of extends module.
When Ivy has finished the resolve task, it outputs a summary of what has been resolved. This summary looks like this:
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 4 | 0 | 0 | 0 || 4 | 0 |
---------------------------------------------------------------------
This table gives some statistics about the dependency resolution. Each line correspond to a configuration resolved. Then the table is divided in two parts:
-
modules
-
number
: the total number of dependency modules resolved in this configuration, including transitive ones -
search
: the number of dependency modules that required a repository access. The repository access is needed if the module is not yet in cache, or if a latest version is required, or in some other cases (depending oncheckModified
, for instance) -
dwnlded
: the number of dependency Ivy files downloaded from the repository. This number can be less than the total number of modules even with a clean cache, if no Ivy file is provided for some dependencies. -
evicted
: the number of dependency module evicted by conflict managers.
-
-
artifacts
-
number
: the total number of artifacts resolved in the given configuration. -
dwnlded
: the number of artifacts actually downloaded from the repository.
-
Inline mode
[since 1.4]
The inline mode allows to call a resolve without an Ivy file, by setting directly the module which should be resolved from the repository. It is particularly useful to install released software, like an Ant task for example. When `inline` is set to `true`, the organisation module and revision attributes are used to specify which module should be resolved from the repository.
Remark: if you want the standard Ivy properties to be set or to reuse the results of an inline resolve by other post-resolve tasks like retrieve
, cachepath
, report
…, you must set the keep attribute to true
!
Resolve mode
[since 2.0]
The resolve mode allows to define how Ivy should use dependency revision constraints when performing the resolution.
Two modes are available:
-
default
: in this mode the default revision constraint (expressed with therev
attribute in the dependency element) is used. -
dynamic
: in this mode the dynamic revision constraint (expressed with therevConstraint
attribute in the dependency element) is used.
Concurrency
During resolve, Ivy creates a file in the resolution cache. The creation of this file is not aimed to support concurrency, meaning that you can’t have two concurrent resolve of the same module, in the same resolution cache, with the same resolveId
.
Note for developers: after the call to this task, a reference to the module descriptor resolved is put in the Ant project under the id ivy.resolved.descriptor
.
Attributes
Attribute | Description | Required |
---|---|---|
file |
path to the Ivy file to use for resolution |
No. Defaults to |
conf |
a comma separated list of the configurations to resolve, or |
No. Defaults to |
refresh |
|
No. defaults to |
resolveMode |
the resolve mode to use for this dependency resolution process (since 2.0) |
No. defaults to using the resolve mode set in the settings |
inline |
|
No. defaults to |
keep |
|
No. defaults to |
organisation |
the organisation of the module to resolve in inline mode (since 1.4) |
Yes in inline mode, no otherwise. |
module |
the name of the module to resolve in inline mode (since 1.4) |
Yes in inline mode, no otherwise. |
revision |
the revision constraint to apply to the module to resolve in inline mode (since 1.4) |
No. Defaults to |
branch |
the name of the branch to resolve in inline mode (since 2.1) |
Defaults to no branch in inline mode, nothing in standard mode. |
changing |
indicates that the module may change when resolving in inline mode. See cache and change management for details. Ignored when resolving in standard mode. (since 1.4) |
No. Defaults to |
type |
comma separated list of accepted artifact types (since 1.2) |
No. defaults to |
haltonfailure |
|
No. Defaults to |
failureproperty |
the name of the property to set if the resolve failed (since 1.4) |
No. No property is set by default. |
transitive |
|
No. Defaults to |
showprogress |
|
No. Defaults to |
validate |
|
No. Defaults to default Ivy value (as configured in settings) |
settingsRef |
A reference to Ivy settings that must be used by this task (since 2.0) |
No, defaults to |
resolveId |
An id which can be used later to refer to the results of this resolve (since 2.0) |
No, defaults to |
log |
the log setting to use during the resolve process (since 2.0) Available options are: |
No, defaults to |
checkIfChanged |
When set to |
No, default to |
useCacheOnly |
When set to |
No, default to |
Child elements
[since 2.3]
These child elements are defining an inlined ivy.xml’s dependencies elements. Thus these child elements cannot be used together with the inline
or file
attributes.
There is one important difference with the ivy.xml’s dependencies: there is no master configuration to handle here. There is actually only one, the one on which the resolve will run. So every attribute in dependency, exclude, override or conflict which is about a master configuration is not supported. And every attribute about a mapping of a master configuration on a dependency configuration is now expecting only the dependency configuration.
Element | Description | Cardinality |
---|---|---|
declares a dependency to resolve |
0..n |
|
excludes artifacts, modules or whole organizations from the set of dependencies to resolve |
0..n |
|
specify an override mediation rule, overriding the revision and/or branch requested for a transitive dependency (since 2.0) |
0..n |
Examples
<ivy:resolve file="path/to/ivy.xml"/>
Resolve all dependencies declared in path/to/ivy.xml file.
<ivy:resolve file="path/to/ivy.xml" transitive="false"/>
Same as above, but with transitive dependencies disabled.
<ivy:resolve file="path/to/ivy.xml" conf="default, test"/>
Resolve the dependencies declared in the configuration default
and test
of the path/to/ivy.xml
file.
<ivy:resolve file="path/to/ivy.xml" type="jar"/>
Resolve all dependencies declared in path/to/ivy.xml
file, but download only jar
artifacts.
<ivy:resolve organisation="apache" module="commons-lang" revision="2+" inline="true"/>
Resolve the commons-lang
module revision 2+ from the repository, with its dependencies.
<ivy:resolve>
<dependency org="apache" name="commons-lang" rev="2+"/>
<dependency org="apache" name="commons-logging" rev="1.1"/>
<exclude org="apache" module="log4j"/>
</ivy:resolve>
Resolve of both commons-lang
and commons-logging
, with their dependencies but not log4j
.
<ivy:resolve>
<dependency org="org.slf4j" module="slf4j" rev="1.6" conf="api,log4j"/>
</ivy:resolve>
Resolve the configurations api
and log4j
of slf4j
.