How To Start with Artifactory and Gradle [Video]

How To Start with Artifactory and Gradle [Video]

AuthorFullName__c
Sam Rosenstein
articleNumber
000005087
FirstPublishedDate
2021-05-26T09:54:09Z
lastModifiedDate
2025-06-15
VersionNumber
8

This JFrog Support tutorial covers using Gradle with Artifactory. In the tutorial we will discuss the following topics:

  • Setting up Gradle repositories in Artifactory
  • Using the remote Gradle repository to resolve dependencies for the Gradle project
  • Using the Artifactory Gradle Plugin to deploy artifacts and build information to Artifactory

Relevant Links:
JFrog Project Examples Github project
Using Gradle with Artifactory Wiki
Gradle Artifactory Plugin Wiki


 

Video Transcript
Hello everyone and welcome to another video.
My name is Patrick and I'm with JFrog Support.
Today I will be going over how to set up Artifactory as a repository to work with Gradle.

To do so, I'm going to be covering three main topics:
First, I'm going to show you how to quickly set up a set of Gradle repositories in Artifactory.
Then I will demonstrate how you can configure your Gradle project to pull dependencies from Artifactory.
Finally, I'll show you how to deploy the Gradle Artifactory plugin to your project to upload built artifacts.

To get started, let's configure Artifactory to have some Gradle repositories.
As an admin, head to the Admin button up here at the top (that's your user profile), and then click Quick Repository Creation.
This will display a popup containing all the different repository types we can quickly create.
Let's select Gradle from the menu.

This is going to create a series of repositories we would recommend for Gradle projects.
I'm going to type in the prefix here, I'm choosing "demo", so we're going to have a local dev repository, a release repository, and a remote repository.
Our snapshot builds should go in the dev-local, and the release builds should go in the release-local.
We'll be downloading all our dependencies from Maven Central via the remote.

To make things easy, you can add these repositories together in a virtual repository - so we've got one for dev and one for release.

There we go - all the repositories have been configured and set up automatically.
Next, we're going to need a Gradle project.

Over on the JFrog GitHub, we have the example projects list right here, including a series of Gradle projects.
I'm going to copy the GitHub link and head over to my Linux VM.

Over here in my Linux folder, I'm going to type in git clone and then paste in the project examples link.

There we go, inside the project examples folder are some Gradle examples.
For today's demo, we'll be using the gradle-example-minimal.

This is a very simple Gradle project, and it comes preconfigured in the build.gradle to resolve and push artifacts to Artifactory.
We're going to need to update the URLs though, I'm running Artifactory on localhost.
So instead of libs-release, we're going to be using demo-gradle-release.

This is for resolving dependencies, so we'll be downloading released binaries from Maven Central.

We will also need to change our repository key here.
So instead of libs-snapshot-local, it is going to be demo-gradle-dev-local.

With those two changes in place, I'm going to save and quit.

To configure your username and password, you can modify the gradle.properties file.

Let me first demonstrate resolving dependencies by using the gradlew build command.
I'm going to be using the gradlew binary that comes with the project.

The build was successful.
Let me go ahead and rerun this without the refresh dependencies operation.

Now let's publish this build.
To do so, I'm going to be calling a new task.

This task is available when you have installed the Artifactory plugin.

As you can see, it has deployed my minimal JAR files to Artifactory.
It has also created a build info object and uploaded that to Artifactory as well.
It can be found over in the Application Builds menu.

This latest build contains my example files.
You can also view them over in the Artifacts Browser.

That's basically it.
If you have any questions, feel free to ask by leaving a comment below, or you can reach out to us by email over in the JFrog Help Center.