Search code examples
gradleartifactory

Gradle distribution remote repo


Does anyone know how to create a remote repo that pulls packages from https://services.gradle.org/distributions/ ?

This post seems to indicate it's possible, but I haven't had any luck.

This post refers to a video with some instructions, but those don't appear to apply to the version we're on (v7.15).

I suspect I probably need a custom layout, but the file names don't seem to play nicely with the parts Artifactory is expecting.

Here is one of my attempts: Screenshot of repo setup

and set this in the gradle-wrapper.properties:

distributionUrl=https://<server_name>:443/artifactory/gradle-dist/distributions/gradle-6.8-bin.zip

But it does not work. I'm not able to browse the repo in the Artifactory website nor can I execute the build.


Solution

  • To use Artifactory as a source for Gradle distributions, do the following:

    1. Create a remote generic repository in Artifactory with the URL pointing to https://services.gradle.org/distributions.
    2. Create the Gradle wrapper. As instructed in the Gradle wrapper documentation, you must provide the full URL to the Gradle distibution zip:
      gradle wrapper --gradle-distribution-url=<artifactory-url>/gradle-dist/gradle-5.6.4-bin.zip
      

    If authentication is needed, you can add username and password as system properties when running the Gradle commands:

    ./gradlew --version -Dgradle.wrapperUser=<artifactory-username> -Dgradle.wrapperPassword=<artifactory-password>
    

    Read more:

    1. Artifactory remote repositories
    2. The Gradle wrapper