////
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

     https://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
////

[*__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 link:../osgi{outfilesuffix}[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 link:../use/postresolvetask{outfilesuffix}[post resolve task], with all the behaviour and attributes common to all post resolve tasks.

== Attributes

[options="header",cols="15%,50%,35%"]
|=======
|Attribute|Description|Required
|tofile|The location of the Ivy file to generate|Yes
|=======

== Child elements

[options="header",cols="15%,50%,35%"]
|=======
|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

[source,xml]
----
<ivy:fixdeps tofile="ivy-fixed.xml"/>
----

Simple fix of some dependencies.

'''

[source,xml]
----
<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.
