Skip to main content
Version: 3.11

Add ScalarDB SQL to Your Build

The ScalarDB SQL libraries are available on the Maven Central Repository and as packages on GitHub. You can add the libraries as a build dependency to your application by using Gradle or Maven.

warning

You must have a commercial license and permission to access the ScalarDB SQL libraries. If you need a commercial license, please contact us.

Configure your application based on your build tool​

Select your build tool, and follow the instructions to add the build dependency for ScalarDB SQL for your application.

The following instructions describe how to add the build dependency for ScalarDB SQL to your application by using Gradle. For details about using package repositories with Gradle, see Working with the Gradle registry.

Configure your GitHub credentials for Gradle​

Before adding the build dependency for ScalarDB SQL to your application by using Gradle, you need to configure your GitHub credentials to access the package repository.

To access the dependency on GitHub, add the following to build.gradle in your application:

repositories {
maven {
url = uri("https://maven.pkg.github.com/scalar-labs/scalardb-sql")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}

To configure the gpr.user property for your GitHub username and the gpr.key property for your personal access token, do one of the following:

  • Store your GitHub credentials as properties in ~/.gradle/gradle.properties

    • Open ~/.gradle/gradle.properties, and store your GitHub credentials as properties by running the following command, replacing <GITHUB_USERNAME> with your username and <GITHUB_PERSONAL_ACCESS_TOKEN> with a personal access token:
    ./gradlew build -Pgpr.user=<GITHUB_USERNAME> -Pgpr.key=<GITHUB_PERSONAL_ACCESS_TOKEN>
  • Store your GitHub credentials as environment variables

    1. Open a terminal window, and store your GitHub username as an environment variable by running the following command, replacing <GITHUB_USERNAME> with your username:
    export USERNAME=<GITHUB_USERNAME>
    1. Store your GitHub personal access token as an environment variable by running the following command, replacing <GITHUB_PERSONAL_ACCESS_TOKEN> with a personal access token:
    export TOKEN=<GITHUB_PERSONAL_ACCESS_TOKEN>

Add the build dependency for ScalarDB SQL by using Gradle​

After specifying your GitHub credentials, add the following ScalarDB SQL dependency to build.gradle in your application, replacing <VERSION> with the version of ScalarDB SQL that you want to use:

dependencies {
// For Direct mode
implementation 'com.scalar-labs:scalardb-sql-direct-mode:<VERSION>'

// For Server mode
implementation 'com.scalar-labs:scalardb-sql-server-mode:<VERSION>'
}