# Getting Started in Java

To get started with Nitrite database, you need to add the Nitrite BOM to your project. The BOM will help you to manage the dependencies. Details of the BOM can be found here.

To add the BOM to your project, follow the steps below:

# Add dependency

Add Nitrite dependency to your project:

# Maven

Add the nitrite dependency to your pom.xml file:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.dizitart</groupId>
            <artifactId>nitrite-bom</artifactId>
            <version>[latest version]</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.dizitart</groupId>
        <artifactId>nitrite</artifactId>
    </dependency>
</dependencies>

# Gradle

Add the nitrite dependency to your build.gradle file:

dependencies {
    implementation platform('org.dizitart:nitrite-bom:[latest version]')
    implementation 'org.dizitart:nitrite'
}

The latest released version of Nitrite can be found here.

# Snapshot builds

Snapshot builds are available from Sonatype.

To use snapshot builds, you need to add the following repository to your pom.xml file:

<repositories>
    <repository>
        <id>sonatype-snapshot</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

Or, if you are using Gradle, add the following repository to your build.gradle file:

repositories {
    mavenCentral()
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
}

# Upgrade from 3.x

If you are upgrading from 3.x, please note that there are lots of breaking changes in the API. The whole library is re-written from scratch. It is recommended to go through this guide before upgrading.

Nitrite will try to migrate your existing database to the latest version on the best effort basis without any guarantee provided you are using the MVStore module. If you are using the RocksDB module, you need to migrate your database manually. However, it is recommended to take a backup of your database before upgrading.