Skip to end of metadata
Go to start of metadata
Table of Contents

Setting up Ivy to work with Artifactory

To enable Ivy to work with Artifactory, the following files must be present and configured:

  1. The Ivy settings - ivysettings.xml - used to configure artifact resolution and deployment using repositories in Artifactory.
  2. The Ivy modules - ivy.xml - where the project's modules and dependencies are declared.
  3. The Ant build - build.xml - which is used to execute the ANT tasks that will, in turn, use Ivy for artifact resolution and deployment.

Ivy Settings - ivysettings.xml

The ivysettings.xml file holds a chain of Ivy resolvers used for both resolution and publishing (deployment). Resolvers exist for both regular artifacts and Ivy module files.

There are a two options to set up Ivy to work with Artifactory by configuring resolvers in ivysettings.xml:

  1. Automatically using the Artifactory's Ivy settings generator, or
  2. Manually defining Ibiblio and URL resolvers.

Automatic Settings with Artifactory's Ivy Settings Generator

To begin quickly, you can use Artifactory's Ivy settings generator to define credentials and resolver settings. This generates a URL resolver suitable for both deployment and resolution.

Provisioning Dynamic Settings for Users

You can deploy and provision a dynamic settings template for your users.

Once downloaded, settings are generated according to your own logic and can automatically include user authentication information.

Refer to Provisioning Build Tool Settings section under Filtered Resources.

Manual Resolver Definitions

The iBiblio Resolver

This resolver is used strictly for dependency resolution. By default, it assumes artifacts in your repository are laid-out in the popular standard Maven 2 format (which may not always be the case).

The ibiblio resolver can resolve artifacts from remote Maven 2 HTTP repositories and if you use version ranges it relies on maven-metadata.xml files in the remote repository to gather information on the available versions.

To use the ibiblio resolver add the following to your ivysettings.xml:

The root URL must point at an Artifactory repository. In this case, the pre-configured 'libs-releases' virtual repository.

The m2compatible property pre-configures the resolver with an artifact pattern that follows the Maven 2 standard layout.

The URL Resolver

The URL resolver can be used for dependency resolution and/or deployment of both regular artifacts and Ivy module files.

To publish or resolve artifacts to/from Artifactory configure a URL resolver with the pattern that matches your target repository layout for both Ivy and artifact files, e.g.:

The URL resolver uses HTML href analysis to learn about the available versions of a remote artifact. This is a less reliable method compared to the iBiblio resolver way, though it works well with remote Artifactory servers.

Using a Chain Resolver

You can mix resolvers under a chain resolver in Ivy which uses sub-resolvers for dependency resolution and publishing.

Refer to the Relevant Ivy Documentation.

Ivy Modules - ivy.xml

ivy.xml files contain a list of dependency declarations that are required to be resolved for the build.

Under the Artifacts tab of the configuration, you can obtain dependency declaration snippets by selecting either an Ivy module or a POM artifact and copying the "Ivy Dependency Declaration" section into your ivy.xml file.

Ant Build - build.xml

To work with Ivy for dependency resolution you must use <ivy:configure/> in your build.xml file. This will load the ivysettings.xml.

The resolution of artifacts is done using <ivy:retrieve/>.

 Refer to the Ivy Documentation for more detailed information.

Publishing to Artifactory

In order to publish to Artifactory the <ivy:publish> command must be used. Ivy uses the configured resolver to deploy your artifact into Artifactory.

For example:

Using a Dedicated Settings File for Deployment

If you have defined your deployment settings, including the required credentials in a dedicated settings file, you can refer to it by defining a unique ID for your settings:

Then point the publish task at these settings, by adding the following attribute to the publish element:

Please consult the Ivy documentation for more detailed information.


  • No labels