ARTIFACTORY: How to mirror Google repository using Gradle remote repository in Artifactory
Introduction:
This article provides a step-by-step guide on how to configure the Google Maven repository with Gradle and Artifactory. The Google Maven repository is primarily utilized by Android Studio and other applications for build jobs. It is highly recommended to leverage the Artifactory Gradle repository in conjunction with Gradle tools to ensure accurate dependency resolution.
Configuring the Google Remote Repository:
Step 1: Create a Gradle Remote Repository in Artifactory UI
- Access the Artifactory UI and create a new remote repository named "test_gradle."
- Set the registry URL to https://maven.google.com/.
Step 2: Configure a Virtual Repository
- Create a virtual repository called "test-gradle-release."
- Add the previously created remote repository to the virtual repository.
Step 3: Modify the build.gradle Configuration File
- Open the build.gradle file.
- Under the "dependencies" section, specify the required packages and configure the repository.
Sample Snippet of Build.Gradle:
buildscript {
repositories {
maven {
url = uri("http://localhost:8082/artifactory/test-gradle-release")
allowInsecureProtocol = true
credentials {
username = "admin"
password = "<password>"
}
}
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.+')
classpath("com.android.tools.build:gradle:7.3.1")
}
}
Step 4: Building the Project:
Build the project, and you will notice that all the dependencies from the Google repository are downloaded into your remote repository cache.
Cached Artifacts:
Useful Gradle Repositories:
1. Maven Central Repository: https://repo1.maven.org/maven2/
2. Gradle Plugin Portal: https://plugins.gradle.org/m2/
3. Google Maven Repository: https://maven.google.com
References:
1. JFrog Artifactory Documentation: Remote Repositories (https://jfrog.com/help/r/jfrog-artifactory-documentation/remote-repositories)
2. JFrog Integrations Documentation: Working with Gradle (https://jfrog.com/help/r/jfrog-integrations-documentation/working-with-gradle)
3. Google Maven Repository (https://maven.google.com/web/index.html)