Skip to content

DOCSP-48094: BOM #663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 54 additions & 6 deletions source/get-started.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,62 @@ its dependencies in your development environment.
or `Creating New Gradle Builds <https://guides.gradle.org/creating-new-gradle-builds/>`__
to learn how to set up your project.

.. step:: Add the {+driver-short+} Bill of Materials

.. _java-get-started-install-bom:

In your IDE, create a new `Maven <https://maven.apache.org/>`__ or
`Gradle <https://gradle.org/>`__ project. Add the Bill of
Materials (BOM) for MongoDB JVM artifacts to your project to
organize dependency versions. The BOM simplifies dependency
management by ensuring that you maintain consistent and compatible
versions of dependencies, such as between the {+driver-short+} and
the core driver library. Use the BOM to avoid version conflicts
and simplify upgrades.

Select from the following :guilabel:`Maven` and :guilabel:`Gradle` tabs
to view instructions for adding the BOM for each dependency manager:

.. tabs::

.. tab:: Maven
:tabid: maven bom

Add the following code to the ``dependencyManagement`` list in your ``pom.xml`` file:

.. code-block:: xml

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-bom</artifactId>
<version>{+full-version+}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

.. tab:: Gradle
:tabid: gradle bom

.. code-block:: groovy

dependencies {
implementation(platform("org.mongodb:mongodb-driver-bom:{+full-version+}"))
}

.. step:: Install the {+driver-short+}

In your IDE, create a new `Maven <https://maven.apache.org/>`__ or `Gradle <https://gradle.org/>`__
project. If you use Maven, add the following code to your ``pom.xml`` dependencies list:
If you use Maven, add the following code to your ``pom.xml`` dependencies list:

.. code-block:: xml

<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>{+full-version+}</version>
</dependency>
</dependencies>

Expand All @@ -90,13 +134,17 @@ its dependencies in your development environment.
.. code-block:: groovy

dependencies {
implementation 'org.mongodb:mongodb-driver-sync:{+full-version+}'
implementation 'org.mongodb:mongodb-driver-sync'
}

Because you installed the BOM, you can omit a version in the
{+driver-short+} dependency entry. The version you specify in the
BOM determines the dependency versions to install.

After you configure your dependencies, ensure they are available to your
project by running your dependency manager and refreshing
the project in your IDE.

After you complete these steps, you have a new project
and the driver dependencies installed.

Expand Down Expand Up @@ -247,4 +295,4 @@ visiting the following guides:
- :ref:`java-db-coll`: Learn more about interacting with
MongoDB databases and collections.
- :ref:`java-integrations`: Learn about the third-party
integrations that you can use with the {+driver-short+}.
integrations that you can use with the {+driver-short+}.
6 changes: 6 additions & 0 deletions source/references/whats-new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ What's New in 5.4
The 5.4 driver release includes the following changes, fixes,
and features:

- Introduces a Bill of Materials (BOM) to manage versions of MongoDB JVM
artifacts you might use in your application. To view instructions on
adding the BOM to your application, see the
:ref:`Add the {+driver-short+} Bill of Materials
<java-get-started-install-bom>` step of the Get Started tutorial.

.. sharedinclude:: dbx/jvm/v5.4-wn-items.rst

.. replacement:: sort-option-link
Expand Down
Loading