Setting up Ivy to work with Artifactory
To enable Ivy to work with Artifactory, the following files must be present and configured:
- The Ivy settings -
ivysettings.xml - used to configure artifact resolution and deployment using repositories in Artifactory.
- The Ivy modules -
ivy.xml - where the project's modules and dependencies are declared.
- 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 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
- Automatically using the Artifactory's Ivy settings generator, or
- 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
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.:
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 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
Ant Build -
To work with Ivy for dependency resolution you must use
<ivy:configure/> in your
build.xml file. This will load the
The resolution of artifacts is done using
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.
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
Please consult the Ivy documentation for more detailed information.