---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.5
alternate:
  - https://catboost.ai/docs/en/installation/spark-installation-build-from-source-maven.md
  - href: en/installation/spark-installation-build-from-source-maven.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# Build from source using Maven

## Dependencies and requirements

{% note warning %}

<!-- source: en/_includes/work_src/reusage-installation/ya-make-to-cmake-switch.md -->
CatBoost uses [CMake](https://cmake.org/)-based build process since [this commit](https://github.com/catboost/catboost/commit/c5c642ca0b8e093336d0229ac4b14c78db3915bb). Previously `Ya Make` (Yandex's build system) had been used.
<!-- endsource: en/_includes/work_src/reusage-installation/ya-make-to-cmake-switch.md -->

Select the appropriate build environment setup below accordingly.

{% endnote %}

* Linux or macOS. Windows support in progress.

* Set up build environment depending on build type:
  - [For CMake](https://catboost.ai/docs/en/installation/build-environment-setup-for-cmake.md)
  - [For Ya Make](https://catboost.ai/docs/en/installation/build-environment-setup-for-ya-make.md)

* Python. 3.6+
* Maven 3.3.9+
* JDK

  JDK version depends on Apache Spark version:
  * Use JDK 8 for Apache Spark 3.x
  * Use JDK 17 for Apache Spark 4.x.

  Set `JAVA_HOME` environment variable to point to the path of JDK installation
* [Only for Ya Make] SWIG 4.0.2+

  Cmake-based build uses SWIG from Conan packages so an explicit installation is not required.

## Building steps

1. Clone the repository:

    ```
    git clone https://github.com/catboost/catboost.git
    ```

2. Go to the `catboost/catboost/spark/catboost4j-spark` directory from the local copy of the CatBoost repository.
3. Run `python ./generate_projects/generate.py` to generate Maven projects for all supported Spark and Scala versions combinations.
4. Go to the sub-directories `./projects/spark_<spark_compat_version>_<scala_compat_version>` for `spark_compat_version` and `scala_compat_version` you are interested in.
5. Use [the usual maven build phases](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html) in these directories.
