Artifactory fully supports working with Maven both as a source for artifacts needed for a build, and as a target to deploy artifacts generated in the build process. Maven is configured using a
The default values in this file configure Maven to work with a default set of repositories used to resolve artifacts and a default set of plugins.
To work with Artifactory you need to configure Maven to perform the following two steps:
Once your Maven build is configured, Artifactory also provides tight integration with commonly used CI servers (such as Jenkins, TeamCity or a Bamboo) through a set of plugins that you can freely install and use.
Viewing Maven Artifacts
If you select a Maven metadata file (maven-metadata.xml) or a POM file (pom.xml) in the Tree Browser, Artifactory provides corresponding tabs allowing you to view details on the selected item.
Maven Metadata View
Resolving Artifacts through Artifactory
To configure Maven to resolve artifacts through Artifactory you need to modify the
Automatically Generating Settings
To make it easy for you to configure Maven to work with Artifactory, Artifactory can automatically generate a
The definitions in the generated
In the Home tab of the Artifactory UI, under Client Settings, select Maven Settings and specify the repositories you want Maven to use to resolve artifacts.
Once you have configured the settings for Maven you can click "Generate Settings" to generate and save the
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.
Manually Overriding the Built-in Repositories
To override the built-in central and snapshot repositories of Maven, you need to ensure that Artifactory is correctly configured so that no request is ever sent directly to them.
To do so, you need to insert the following into your parent POM or
Additional Mirror Any Setup
In addition to overriding built-in Maven repositories, you can use the Mirror Any setting to redirect all requests to a Maven repository through Artifactory, including those defined inside POMs of plug-ins and third party dependencies. (While it does not adhere to best practices, it is not uncommon for POMs to reference Maven repositories directly). This ensures no unexpected requests directly to Maven are introduced by such POMs.
You can either check Mirror Any in the Maven Settings screen when generating your
Artifactory requires user authentication in three cases:
Authentication is configured in Maven using
Each <repository> and <mirror> element specified in the file must have a corresponding <server> element with a matching <id> that specifies the username and password.
The sample snippet below emphasizes that the
The same would hold for <mirror> elements that require authentication.
In both cases the username is
Watch the Screencast
Deploying Artifacts Through Artifactory
Setting Up Distribution Management
To deploy build artifacts through Artifactory you must add a deployment element with the URL of a target local repository to which you want to deploy your artifacts.
To make this easier, Artifactory displays a code snippet that you can use as your deployment element under Distribution Management when you view a local repository in the Artifacts tab under Browse | Tree Browser.
Setting Up Security in Maven Settings
When deploying your Maven builds through Artifactory, you must ensure that any
Watch the Screencast