Gradle Builds

JFrog Integrations Documentation


The Jenkins Artifactory Plugin supports Gradle build jobs, allowing your build jobs deploy artifacts and resolve dependencies to and from Artifactory, and then have them linked to the build job that created them.

As described below, using the Jenkins Gradle Plugin, you can create a freestyle job with the Artifactory Gradle integration.

To help you get started, you can use gradle-example-ci-server as a sample project you can build from your Jenkins Gradle job.

JDK compatibility

From version 3.0.0, the plugin no longer supports building with JDK 7.

Gradle Compatibility

The minimum Gradle version supported is 4.10

Integration Benefits JFrog Artifactory and Gradle

create a gradle job.png
Configuring Gradle Builds

Deploy Artifacts to Artifactory

Once you have at least one Artifactory server configured, you can add the deployment details in your Gradle build.

Deploy Artifacts to Artifactory_Gradle.png



Artifactory deployment server

Artifactory server as defined in the Artifactory plugin configuration. The selected server will be used for artifacts resolution and build info deployment.

Publishing repository

Repository to deploy artifacts to.

Using the text mode will enable you to also use placeholders for environment variable which will be replaced with your environment value at build time.

Custom staging configuration

Select a named staging configuration defined by an Artifactory User Plugin or select "None" to use the default staging settings.

Override default credentials

Override default credentials.

Resolve Artifacts from Artifactory
Resolve Artifacts from Artifactory_Gradle.png



Artifactory resolve server

Artifactory server as defined in the Artifactory plugin configuration. The selected server will be used for artifacts resolution and build info deployment.

Resolution repository

Repository used to download artifacts from.

Override default credentials

Override default credentials.

Job Configuration
Job Configuration_Gradle.png



Project uses the Artifactory Gradle Plugin

If this checkbox is not set, Jenkins assumes that the com.jfrog.artifactory plugin is not applied in the gradle script. It will then try to apply it, by adding an init script when triggering the gradle build.

Capture and publish build info

Check if you wish to publish build information to Artifactory.

Override build name

Check if you wish to override Artifactory default build name.

Publish artifacts to Artifactory

Check if you wish to publish produced build artifacts to Artifactory.

Publish Maven descriptors

Check if you wish to publish Gradle-generated POM files to Artifactory. Note: Maven descriptors are always deployed according to the Maven layout convention.

Publish Ivy descriptors

Check if you wish to publish Gradle-generated ivy.xml descriptor files to Artifactory.

Use Maven compatible patterns

Whether to use the default Maven patterns when publishing artifacts and Ivy descriptors, or to use custom patterns. Dots in [organization] will be converted to slashes on path transformation.

Filter excluded artifacts from build Info

Add the excluded files to the excludedArtifacts list and remove them from the artifacts list in the build info.

Enable isolated resolution for downstream builds (requires Artifactory Pro

When checked, a build parameter named ARTIFACTORY_BUILD_ROOT with a value of ${JOB_NAME}-${BUILD_NUMBER} will be sent to downstream builds.

For example: ARTIFACTORY_BUILD_ROOT=Infrastructure-1025. The value of the parameter is also attached to published artifacts as the property: build.root as a matrix parameter on the deployment URL.

Downstream builds will add build.root=${ARTIFACTORY_BUILD_ROOT} as a matrix parameter to their Artifactory resolution URL

For example: build.root=Infrastructure-1025 to achieve isolated resolution from Artifactory and only resolve artifacts produced by the root build that triggered it, avoiding any artifacts produced by other runs that are out of the build chain.

Enable release management

Artifactory supports release management through the Jenkins Artifactory Plugin.

When you run your builds using Maven or Gradle with jobs that use Git or Perforce as your version control system, you can manually stage a release build allowing you to:

  • Change values for the release and next development version.

  • Choose a target staging repository for deployment of the release.

  • Create a VCS tag for the release.

Staged release builds can later be promoted or rolled-back, changing their release status in Artifactory and, optionally, moving the build artifacts to a different target repository.

Inside Artifactory, the history of all build status change activities (staged, promoted, rolled-back, etc.) is recorded and displayed for full traceability.

When release management is enabled, the Artifactory release staging link appears on the top header bar in the job page.

Build Configuration

The build Goals and options should be set to clean install

Build configuration_Gradle.png



Gradle Version

The Maven version.


Specify the Gradle task to be invoked. The artifactoryPublish task will build your Gradle project and publish your artifacts to Artifactory.

Using Default Values in the Gradle Build Script

Behind the scenes, the Jenkins Artifactory Plugin utilises the Gradle Artifactory Plugin. It does that by injecting the Jenkins job's configuration into the artifactory closure defined by the Gradle Artifactory Plugin.

You also have the option of defining the artifactory closure in the build script with default values. When the Jenkins job is triggered, it will override these values with the values defined in the job configuration.


Since the resolution details are not defined as part of the artifactory closure in the gradle script, they cannot be overridden by the Jenkins job.