How to build Gravitino
Prerequisites
- Linux or macOS operating system
- Git
- A Java Development Kit, version 8 to 17, installed in your environment to launch Gradle
- Python 3.8, 3.9, 3.10, or 3.11 to build the Gravitino Python client
- Optionally, Docker to run integration tests
- Gravitino requires at least JDK8 and at most JDK17 to run Gradle, so you need to install a JDK, versions 8 to 17, to launch the build environment.
- Gravitino itself supports using JDK8, 11, and 17 to build. The Gravitino Trino connector uses JDK17 to build (to avoid vendor-related issues on some platforms, Gravitino uses the specified Amazon Corretto OpenJDK 17 to build the Trino connector on macOS). You don't have to preinstall the specified JDK environment, as Gradle detects the JDK version needed and downloads it automatically.
- Gravitino uses the Gradle Java Toolchain to detect and manage JDK versions, it checks the
installed JDK by running the ./gradlew javaToolchainscommand. See Gradle Java Toolchain.
- Make sure you have installed Docker in your environment if you plan to run integration texts. Without it, some Docker-related tests may not run.
- macOS uses docker-connectorto make the Gravitino Trino connector work with Docker for macOS. See docker-connector,$GRAVITINO_HOME/dev/docker/tools/mac-docker-connector.sh, and$GRAVITINO_HOME/dev/docker/tools/README.mdfor more details.
- You can use OrbStack as a replacement for Docker for macOS. See
OrbStack. With OrbStack you can run Gravitino integration tests
without needing to install docker-connector.
Quick start
- 
Clone the Gravitino project. git clone git@github.com:datastrato/gravitino.git
- 
Build the Gravitino project. cd gravitino
 ./gradlew buildThe default specified JDK version is 8, if you want to use JDK 11 or 17 to build, modify the property jdkVersionto 11 or 17 in thegradle.propertiesfile, or specify the version with-P, like:./gradlew build -PjdkVersion=11Or: ./gradlew build -PjdkVersion=17The ./gradlew buildcommand builds all the Gravitino components, including Gravitino server, Java and Python client, Trino and Spark connectors, and more.For Python client, the ./gradlew buildcommand builds the Python client with Python 3.8 by default. If you want to use Python 3.9, 3.10 or 3.11 to build, please modify the propertypythonVersionto 3.9, 3.10 or 3.11 in thegradle.propertiesfile, or specify the version with-P, like:./gradlew build -PpythonVersion=3.9Or: ./gradlew build -PpythonVersion=3.10Or: ./gradlew build -PpythonVersion=3.11If you want to build some modules alone, like Spark connector, you can use Gradle build task with specific module name, like: ./gradlew spark-connector:spark-connector-runtime:buildThis creates gravitino-spark-connector-runtime-{sparkVersion}_{scalaVersion}-{version}.jarunder thespark-connector/spark-connector-runtime/build/libsdirectory.noteThe first time you build the project, downloading the dependencies may take a while. You can add -x testto skip the tests, by using./gradlew build -x test.The built Gravitino libraries are Java 8 compatible, and verified under Java 8, 11, and 17 environments. You can use Java 8, 11, 17 runtimes to run the Gravitino server, no matter which JDK version you use to build the project. The built jars are under the build/libsdirectory of the modules. You can publish them to your Maven repository to use them in your project.
- 
Get the Gravitino server binary package. ./gradlew compileDistributionThe compileDistributioncommand creates adistributiondirectory in the Gravitino root directory.The directory structure of the distributiondirectory is as follows:noteThe ./gradlew cleancommand deletes thedistributiondirectory.
- 
Assemble the Gravitino server distribution package. ./gradlew assembleDistributionThe assembleDistributioncommand createsgravitino-{version}-bin.tar.gzandgravitino-{version}-bin.tar.gz.sha256under thedistributiondirectory.You can deploy them to your production environment. noteThe gravitino-{version}-bin.tar.gzfile is the Gravitino server distribution package, and thegravitino-{version}-bin.tar.gz.sha256file is the sha256 checksum file for the Gravitino server distribution package.
- 
Assemble the Gravitino Trino connector package ./gradlew assembleTrinoConnectoror ./gradlew assembleDistributionThis creates gravitino-trino-connector-{version}.tar.gzandgravitino-trino-connector-{version}.tar.gz.sha256under thedistributiondirectory. You can uncompress and deploy it to Trino to use the Gravitino Trino connector.