fixdeps

[since 2.4]

The fixdeps task serializes transitively resolved dependencies into an ivy.xml file.

The dependencies declared in an ivy.xml can be specified as range of revisions. And the transitive dependencies too. As new versions of modules can be added to the repository anytime, resolved versions of ranges can change over time. It is then safer to resolve a range once and stick with the resolved revision. This way a resolve process is highly reproducible.

It is especially useful in a very dynamic environment like the OSGi one.

In a multi project environment some dependencies still need to be maintained loose: the ones between the projects. These dependencies, as soon as they are declared in the original ivy.xml, can be kept from being fixed. In order to do so, use the inner element keep.

The recommended setup is then to:

  • have an ivy-spec.xml in your project which specifies the dependencies, with ranges if needed

  • have an Ant target which resolves the ivy-spec.xml and call fixdeps to generate an ivy.xml. This target should then only be called after ivy-spec.xml is modified. The generated ivy.xml can safely be shared in a version control repository (Git, Subversion, …​).

  • make the entire build workflow based on the resolve of the generated ivy.xml

This is a post resolve task, with all the behaviour and attributes common to all post resolve tasks.

Attributes

Attribute Description Required

tofile

The location of the Ivy file to generate

Yes

Child elements

Element Description Cardinality

keep

declares a dependency to keep from being fixed, and keep its original declaration from the original ivy.xml

These elements takes two attributes:
* org: the organization
* module: the name of the module

0..n

Examples

<ivy:fixdeps tofile="ivy-fixed.xml"/>

Simple fix of some dependencies.


<ivy:fixdeps tofile="ivy-fixed.xml">
    <keep org="com.acme" module="mymodule"/>
</ivy:fixdeps>

Fix of the dependencies but keep the dependency on com.acme#mymodule as defined in the original ivy.xml.