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


Artifactory offers full integration with Gradle via two methods:

  1. Build Server Integration - When running Gradle builds in your continuous integration build server, it is recommended to use one of the Artifactory Plugins for Jenkins, TeamCity or Bamboo to configure resolution and publishing to Artifactory with build-info capturing, via your build server UI.
  2. Standalone Integration - As described below, for when running standalone Gradle build scripts using the Gradle Artifactory plugin.
    The Gradle Artifactory plugin offers a simple DSL to perform the following as part of your Gradle build:
    1. Define default dependency resolution from Artifactory
    2. Define configurations whose artifacts to be published to Artifactory after a full (multi-module) successful build
    3. Define properties that to be attached to published artifacts in Artifactory metadata
    4. Capture and publish a build-info object to Artifactory build-info REST API to provide a fully traceable build context


Source Code Available!

This plugin is an open-source project on GitHub. Feel free to browse the source and fork at will.

Gradle Compatibility

Plugin Version

Compatible with Gradle












gradle-1.0-milestone-8 and above

2.0.17gradle-1.0 and above
2.2.1gradle-1.8 and above
2.2.3gradle-1.8 and above

Downloading and Installing the Artifactory Plugin

Add a repository, which has the plugin and the dependency which includes it. For example:

The above script automatically downloads the plugin and makes it available to the buildScript of your projects.

Adding the Plugin to Your Project(s)

In order to apply the plugin in your Gradle projects, the following closure must be declared in your build.gradle script:

In a multi-project build, you might want to apply the plugin to all projects:


Using the Artifactory Plugin DSL

The Gradle Artifactory plugin can be configured using its own convention DSL inside the build.gradle script of your root project.

The syntax of the Convention DSL is shown below.

Mandatory items within the relevant context are prefixed with '+'. All other items are optional.

The Properties Closure DSL

The properties closure in artifactory.publish.defaults and artifactpryPublish task accept the following syntax:

  • A configuration that is a valid name of a configuration of the project. You can use all to apply the properties to all configurations.
  • An artifact specification filter for matching the artifacts to which properties should be attached. The filter may contain wildcards: * for all characters or ? for a single character.
  • A list of key/value(s) properties that are attached to to the published artifacts matching the filter.

The Artifactory Project Publish Task

Behind the scenes the Gradle Artifactory Plugin creates an 'artifactoryPublish' Gradle task for each project the plugin is applied to.

The artifactoryPublish is configured by the publish closure of the plugin.

You can configure the project-level task directly with the task's artifactoryPublish closure, which uses identical Syntax to that of the plugin's publish closure.

Controlling the Published Modules

To control which modules of a multi-module build are published to Artifactory:

  1. Do not apply the 'artifactory' plugin to project so that it does not publish anything.
    NOTE! This cannot be performed for the root project that contains the convention object, and so must have the plugin applied.
  2. Manually activate the corresponding 'artifactoryPublish' Gradle task for each project you wish to.
    For example in our Gradle project example you can run: ./gradlew clean api:artifactory:publish shared:artifactoryPublish
  3. Use the artifactoryPublish.skip flag to deactivate analysis and publication.

Controlling BuildInfo's Build Name and Build Number

By default, BuildInfo is published with a build name that is the name of your root project and a build number that is the start date of the build.

You can control the build name and build number values by specifying the following properties, respectively:

The above properties are specified as standard Gradle Properties.

Watch the Screencast

To see the Gradle Artifactory Plugin in action you can watch the following screencast below.

  • No labels