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 5 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
2 changes: 1 addition & 1 deletion source/connection/connection-troubleshooting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ against the connected secondary node if you set the read preference to

You can also specify the ``serverSelectionTimeoutMS`` connection option
to adjust the amount of time in which the driver must select a server. To
learn more, see the :ref:`java-connection-uri-options` guide.
learn more, see the :ref:`mcs-cluster-settings` guide.

.. _java-miscellaneous-errors:

Expand Down
64 changes: 58 additions & 6 deletions source/get-started.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,66 @@ 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

Add the following code to dependencies list in your
``build.gradle`` file:

.. 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 +138,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 +299,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+}.
16 changes: 8 additions & 8 deletions source/includes/crud/example-intro.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.. note:: Example Setup

This example connects to an instance of MongoDB by using a connection URI. To learn
more about connecting to your MongoDB instance, see the :ref:`connection guide
<connect-to-mongodb>`. This example also uses the ``movies`` collection in the
``sample_mflix`` database included in the :atlas:`Atlas sample datasets
</sample-data?jmp=docs_driver_java>`. You can load them into
your database on the free tier of MongoDB Atlas by following the :atlas:`Get
Started with Atlas Guide
</getting-started/#atlas-getting-started?jmp=docs_driver_java>`.
This example connects to an instance of MongoDB by using a
connection URI. To learn more about connecting to your MongoDB
instance, see the :ref:`java-connect-to-mongodb` guide. This example
also uses the ``movies`` collection in the ``sample_mflix`` database
included in the :atlas:`Atlas sample datasets </sample-data>`. You
can load them into your database on the free tier of MongoDB Atlas
by following the :atlas:`Get Started with Atlas Guide
</getting-started/#atlas-getting-started>`.
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 that 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