Still using Artifactory 3.x ?
Click here for the Artifactory 3.x User Guide

Have a question? Want to report an issue? Contact JFrog support

Skip to end of metadata
Go to start of metadata

Overview

The Gradle Artifactory Plugin allows you to deploy your build artifacts and build information to Artifactory and also to resolve your build dependencies from Artifactory.

Download and Installation

Automatic Installation

Build script snippet for use in all Gradle versions
Build script snippet for use in Gradle 2.1 and above

Currently the "plugins" notation cannot be used for applying the plugin for sub projects, when used from the root build scrip


Page Contents

Manual Installation

The latest plugin jar file can be downloaded from the  JFrog Artifactory public demo.  Copy the jar into your gradle home plugins directory ( ~/.gradle/plugins).
Then add the following line to your project build script:


Configuration

Using the Artifactory Plugin DSL

The Gradle Artifactory plugin is configured using its own Convention DSL inside the build.gradle script of your root project.

The syntax of the Convention DSL is described below:

We highly recommend also using our examples as a reference when configuring the DSL in your build scripts.

 

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

Using the old Gradle publishing mechanism?  Expand source

The Artifactory Project Publish Task

The Artifactory Publishing Plugin creates an artifactoryPublish Gradle task for each project the plugin is applied to. The task 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, are published to Artifactory you can:

  1. Omit the 'artifactory' plugin from a project that does not publish anything. Note that this does not apply to the root project that contains the convention object, and so, requires the plugin to be applied.
  2. Activate the corresponding artifactoryPublish Gradle task manually for each project to which you wish to apply the plugin. 
    For example in our  Gradle project example you can run:

    Activating the plugin manually
  3. Use the artifactoryPublish.skip flag to deactivate analysis and publication.

Controlling the Build Name Number in BuildInfo

By default, BuildInfo is published with a build name constructed from 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 number values by specifying the following properties respectively:

Specifying the build name and number

The above properties should be added to your project's gradle.properties file.


Examples

Project examples which use the Gradle Artifactory Plugin are available here.

 

 

  • No labels