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

Working with Gradle and Artifactory

For Gradle to work with Artifactory, you only require a properly configured build.gradle script file.

To avoid dwelling on configuration details we shall just mention the main configuration steps and show a sample Gradle script that we believe shows all the required information needed to get you started.

 It also demonstrates the effectiveness and brevity of Gradle.

NOTE! that this build script is used for building the Build Integration project as is also available in source control.

Resolution Configuration

Using Artifactory's Gradle Init Script Generator

With Artifactory's Gradle init script generator, you can easily create a Gradle init script that handles resolution.  To do so go to the Home tab and then Client Settings -> Gradle Init Script:

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 Configuration Steps

This section describes a manual integration of Gradle with Artifactory and works for Gradle 0.8.

For Gradle version 0.9-preview-3 and above it is recommended to use the Gradle Artifactory Plugin for publication

  1. Define the Artifactory repository to be used by Gradle for artifacts resolution.
  2. Optionally provide credentials in case you do not allow anonymous artifact downloads on the Artifactory repository.
  3. Define the local repository in Artifactory to which module artifacts are to be deployed.
  4. Optionally provide deployment credentials.
  5. If you would also like Gradle to auto-generate a POM file for your artifacts, define the Maven artifact attributes, and -
  6. Define local Artifactory repository to be used for POM deployment (typically this would be the same as the one used for Gradle/Ivy artifacts).

Sample Build Script and Properties


And the properties file under the same directory:

Running Gradle

The following clause is required for gradle to recognize Artifactory.

To build your project and upload the generated artifacts to Artifactory, run:

Please refer to the Gradle Documentation for more detailed information on building with Gradle (running sub-tasks etc.).

Getting Debugging Information from Gradle

If you experience problems, it is highly recommended to run Gradle with the -d option. This typically provides useful readable information on what went wrong.

Dependency Declaration Snippets

Click on the Artifacts tab to use the Artifactory configuration to obtain dependency declaration snippets by selecting either an artifact and copying the "Gradle Dependency Declaration" section into your build.gradle file.

  • No labels