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

This page describes a new `artifactory-publish` plugin, which is supported along side with the classic `artifactory` plugin. New Gradle versions are supported by both plugins. For documentation of the `artifactory`  plugin, please see this page.


Since Gradle 1.6 the new publishing model for Ivy and Maven publications is fully supported by the new 'artifactory-publish' plugin.

The Gradle Artifactory plugin version supporting this new model is 2.1.0 or above.

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.6 and above

Downloading and Installing the Artifactory Plugin

Manual Installation

The latest plugin jar file can be downloaded from here and copy it to your gradle home plugins directory ~/.gradle/plugins.
And add the following to your project:

Automatic Installation

Alternatively, you can add to your Gradle scripts to fetch the plugin using the standard Ivy resolution. For example:

The above script will automatically download the plugin, and make 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 needs to be declared in your build.gradle script:

In a multi-project build, you'd 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 described 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 artifactoryPublish task accept the following syntax:

A publication that is a valid name of a publication of the project. You can use all to apply the properties to all publications.
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 will be attached to to the published artifacts that match 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.defaults closure.

Controlling the Published Modules

To control which modules of a multi-module build, will be published to Artifactory you can:

  1. Do not apply the 'artifactory' plugin to project should not publish anything. Note: This cannot be done for the root project that contains the convention object, and so needs the plugin applied.
  2. Manual 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 will be 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.

You can also control the values from inside the convention object DSL like showed at the bottom of the DSL code.

Watch the Screencast

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

  • No labels