Using Gradle artifact repositories

Downloading different versions of Gradle

The recommended way to download any version of Gradle is by using the Gradle Wrapper script. If your project does not have a gradle/wrapper directory, run $ gradle wrapper to configure the Wrapper.

  • The Gradle Wrapper is present in your project.


To download a Gradle version from a non-standard location, change your Wrapper settings in /projects/<your_project>/gradle/wrapper/

  • Change the distributionUrl property to point to a URL of the Gradle distribution ZIP file:


Alternatively, you may place a Gradle distribution zip file locally in /project/gradle in your workspace.

  • Change the distributionUrl property to point to a local address of the Gradle distribution zip file:


Configuring global Gradle repositories

Use an initialization script to configure global repositories for the workspace. Gradle performs extra configuration before projects are evaluated, and this configuration is used in each Gradle project from the workspace.


To set global repositories for Gradle that could be used in each Gradle project in the workspace, create an init.gradle script in the ~/.gradle/ directory:

allprojects {
  repositories {
    mavenLocal ()
    maven {
      url ""
      credentials {
        username "admin"
        password "my_password"

This file configures Gradle to use a local Maven repository with the given credentials.

The ~/.gradle directory does not persist in the current Java plug-in versions, so you must create the init.gradle script at each workspace start in the Java plug-in sidecar container.

Using self-signed certificates in Gradle projects

Internal artifact repositories often do not have a certificate signed by an authority that is trusted by default in Java. They are usually signed by an internal company authority or are self-signed. Configure your tools to accept these certificates by adding them to the Java truststore.

  1. Obtain a server certificate file from the repository server. It is often a file named tls.crt.

    1. Create a Java truststore file:

      $ keytool -import -file tls.crt -alias nexus -keystore truststore.jks -storepass changeit
      Trust this certificate? [no]:  yes
      Certificate was added to keystore
      Serial number: 80ca0f6980c6019a
      Valid from: Thu Feb 06 11:00:29 CET 2020 until: Fri Feb 05 11:00:29 CET 2021
      Certificate fingerprints:
           MD5:  88:3C:EC:E1:BE:57:DD:9D:46:36:8E:DD:BF:14:04:22
           SHA1: 08:D8:79:D3:F8:6B:5C:3D:71:AA:23:CA:72:01:47:BD:9D:91:0A:AD
           SHA256: 5C:BB:66:81:44:D2:50:EE:EB:CE:D6:15:7E:63:E1:9A:71:EA:58:3F:14:01:15:4E:68:5D:71:0A:A0:31:33:29
      Signature algorithm name: SHA256withRSA
      Subject Public Key Algorithm: 4096-bit RSA key
      Version: 3
      #1: ObjectId: Criticality=false
      SubjectAlternativeName [
        DNSName: *
      Trust this certificate? [no]:  yes
      Certificate was added to keystore
    2. Upload the truststore file to /projects/gradle/truststore.jks to make it available for all containers.

  2. Add the truststore file in the Gradle container.

    1. Add the system property to the JAVA_OPTS environment variable:

        - mountSources: true
          alias: maven
          type: dockerimage
             -name: JAVA_OPTS
              value: >-