Repository Management with Nexus - 2.12

Share

4.6. Apache Ant and Apache Ivy

Apache Ivy is a dependency manager often used in Apache Ant builds. It supports the Maven repository format and can be configured to download dependencies that can be declared in the ivy.xml file. This configuration can be contained in the ivysettings.xml. A minimal example for resolving dependencies from a repository manager running on localhost is shown in Minimal Apache Ivy Settings.

Minimal Apache Ivy Settings. 

<ivysettings>
  <settings defaultResolver="nexus"/>
  <property name="nexus-public"
                   value="http://localhost:8081/nexus/content/groups/public"/>
  <resolvers>
      <ibiblio name="nexus" m2compatible="true" root="${nexus-public}"/>
    </resolvers>
</ivysettings>

These minimal settings allow the ivy:retrieve task to download the declared dependencies.

To deploy build outputs to a repository with the ivy:publish task, user credentials and the URL of the target repository have to be added to ivysettings.xml and the makepom and publish tasks have to be configured and invoked.

Full example projects can be found in the ant-ivy folder of the documentation examples project. A full build of the simple-project, including downloading the declared dependencies and uploading the build output to the repository manager can be invoked with

cd ant-ivy/simple-project
ant deploy

Further details about using these example projects can be found in Chapter 25, Evaluating Step by Step.