4.3.2. Configuring Access to Repository

Main Repository

When you create a new project, you have to select a main repository containing CUBA artifacts. By default, there are two options (and you can have more if you set up a private repository):

  • https://repo.cuba-platform.com/content/groups/work - a repository located at Haulmont’s server. It requires common credentials which are specified right in the build script (cuba / cuba123).

  • https://dl.bintray.com/cuba-platform/main - a repository hosted at JFrog Bintray. It has anonymous access.

Both repositories have identical contents for the latest platform versions, but Bintray does not contain snapshots. We assume that Bintray is more reliable for worldwide access.

In case of Bintray, the build script of the new project is also configured to use Maven Central, JCenter and Vaadin Add-ons repositories separately.

Bintray artifact repository, available by the https://dl.bintray.com/cuba-platform URL, will soon be shut down by its maintainer (JFrog). Please avoid using the Bintray repository in your projects. The preliminary shutdown schedule is the following:

  • After 31 March 2021:

    • New releases of the platform and add-ons will no longer be uploaded to the Bintray repository.

    • New commercial add-on subscriptions will no longer be given access to the old releases of add-ons located in the Bintray repository.

  • After 1 February 2022:

    • Bintray repository will no longer be available. Existing CUBA projects using this repository will not be able to resolve, build and run.

You should use the second https://repo.cuba-platform.com repository in all projects instead.

Access to CUBA Premium Add-ons

Since version 7.0, the BPM, Charts, Full-Text Search and Reports add-ons have been made free and open-source. They are now located in the main repository described above, so you need to configure the premium repository only for using other premium add-ons, for example, WebDAV.

If your project uses CUBA Premium Add-ons, add one more repository to build.gradle:

  • If the main repository is repo.cuba-platform.com, add https://repo.cuba-platform.com/content/groups/premium

  • If the main repository is Bintray, add https://cuba-platform.bintray.com/premium

Example of adding https://repo.cuba-platform.com/content/groups/premium repository:

buildscript {
    // ...
    repositories {
        // ...
        maven {
            url 'https://repo.cuba-platform.com/content/groups/premium'
            credentials {
                username(rootProject.hasProperty('premiumRepoUser') ?
                        rootProject['premiumRepoUser'] : System.getenv('CUBA_PREMIUM_USER'))
                password(rootProject.hasProperty('premiumRepoPass') ?
                        rootProject['premiumRepoPass'] : System.getenv('CUBA_PREMIUM_PASSWORD'))
            }
        }
    }

Example of adding https://cuba-platform.bintray.com/premium repository:

buildscript {
    // ...
    repositories {
        // ...
        maven {
            url 'https://cuba-platform.bintray.com/premium'
            credentials {
                username(rootProject.hasProperty('bintrayPremiumRepoUser') ?
                        rootProject['bintrayPremiumRepoUser'] : System.getenv('CUBA_PREMIUM_USER'))
                password(rootProject.hasProperty('premiumRepoPass') ?
                        rootProject['premiumRepoPass'] : System.getenv('CUBA_PREMIUM_PASSWORD'))
            }
        }
    }

Both Premium Add-ons repositories require a user name and a password which are provided by per-developer subscription. The first part of your license key before dash is the repository user name, the part after dash is the password. For example, if your key is 111111222222-abcdefabcdef, then the user name is 111111222222 and the password is abcdefabcdef. In case of Bintray, the user name must be followed by @cuba-platform.

You can provide the credentials in one of the following ways.

  • The recommended way is to create a ~/.gradle/gradle.properties file in your user home directory and set properties in it:

    • Example of credentials for https://repo.cuba-platform.com/content/groups/premium repository:

      ~/.gradle/gradle.properties
      premiumRepoUser=111111222222
      premiumRepoPass=abcdefabcdef
    • Example of credentials for https://cuba-platform.bintray.com/premium repository:

      ~/.gradle/gradle.properties
      bintrayPremiumRepoUser=111111222222@cuba-platform
      premiumRepoPass=abcdefabcdef
  • Another way is to set the following environment variables for your operating system:

    • CUBA_PREMIUM_USER - will be used if premiumRepoUser is not set.

    • CUBA_PREMIUM_PASSWORD - will be used if premiumRepoPass is not set.

When you run the Gradle tasks from the command line, you can also pass the properties as command line arguments with the -P prefix, for example:

gradlew assemble -PpremiumRepoUser=111111222222 -PpremiumRepoPass=abcdefabcdef
Custom Repositories

Your project can use any number of custom repositories containing application components. They should be specified in build.gradle manually after the main repository, for example:

repositories {
    // main repository containing CUBA artifacts
    maven {
        url 'https://repo.cuba-platform.com/content/groups/work'
        credentials {
            // ...
        }
    }
    // custom repository
    maven {
        url 'http://localhost:8081/repository/maven-snapshots'
    }
}