Skip to content

Commit 659b5c1

Browse files
committed
DOCSP-48094: BOM
1 parent 7a2160d commit 659b5c1

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed

source/get-started.txt

+51-4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,50 @@ its dependencies in your development environment.
7070
or `Creating New Gradle Builds <https://guides.gradle.org/creating-new-gradle-builds/>`__
7171
to learn how to set up your project.
7272

73+
.. step:: Add the {+driver-short+} Bill of Materials
74+
75+
.. _java-get-started-install-bom:
76+
77+
Add the Bill of Materials (BOM) for the MongoDB JVM
78+
artifacts to your project to organize dependency versions. The BOM
79+
simplifies dependency management by ensuring that you maintain
80+
consistent and compatible versions of dependencies, such as between the
81+
{+driver-short+} and the core driver library. Use the BOM to
82+
avoid version conflicts and simplify upgrades.
83+
84+
Select from the following :guilabel:`Maven` and :guilabel:`Gradle` tabs
85+
to view instructions for adding the BOM for each dependency manager:
86+
87+
.. tabs::
88+
89+
.. tab:: Maven
90+
:tabid: maven bom
91+
92+
Add the following code to the ``dependencyManagement`` list in your ``pom.xml`` file:
93+
94+
.. code-block:: xml
95+
96+
<dependencyManagement>
97+
<dependencies>
98+
<dependency>
99+
<groupId>org.mongodb</groupId>
100+
<artifactId>mongodb-driver-bom</artifactId>
101+
<version>{+full-version+}</version>
102+
<type>pom</type>
103+
<scope>import</scope>
104+
</dependency>
105+
</dependencies>
106+
</dependencyManagement>
107+
108+
.. tab:: Gradle
109+
:tabid: gradle bom
110+
111+
.. code-block:: groovy
112+
113+
dependencies {
114+
implementation(platform("org.mongodb:mongodb-driver-bom:{+full-version+}"))
115+
}
116+
73117
.. step:: Install the {+driver-short+}
74118

75119
In your IDE, create a new `Maven <https://maven.apache.org/>`__ or `Gradle <https://gradle.org/>`__
@@ -81,7 +125,6 @@ its dependencies in your development environment.
81125
<dependency>
82126
<groupId>org.mongodb</groupId>
83127
<artifactId>mongodb-driver-sync</artifactId>
84-
<version>{+full-version+}</version>
85128
</dependency>
86129
</dependencies>
87130

@@ -90,13 +133,17 @@ its dependencies in your development environment.
90133
.. code-block:: groovy
91134

92135
dependencies {
93-
implementation 'org.mongodb:mongodb-driver-sync:{+full-version+}'
136+
implementation 'org.mongodb:mongodb-driver-sync'
94137
}
95138

139+
Because you installed the BOM, you can omit a version in the
140+
{+driver-short+} dependency entry. The version you specify in the
141+
BOM determines the dependency versions to install.
142+
96143
After you configure your dependencies, ensure they are available to your
97144
project by running your dependency manager and refreshing
98145
the project in your IDE.
99-
146+
100147
After you complete these steps, you have a new project
101148
and the driver dependencies installed.
102149

@@ -247,4 +294,4 @@ visiting the following guides:
247294
- :ref:`java-db-coll`: Learn more about interacting with
248295
MongoDB databases and collections.
249296
- :ref:`java-integrations`: Learn about the third-party
250-
integrations that you can use with the {+driver-short+}.
297+
integrations that you can use with the {+driver-short+}.

source/references/whats-new.txt

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ What's New in 5.4
3939
The 5.4 driver release includes the following changes, fixes,
4040
and features:
4141

42+
- Introduces a Bill of Materials (BOM) to manage versions of MongoDB JVM
43+
artifacts you might use in your application. See the
44+
:ref:`java-get-started-install-bom` step of the Get Started with the
45+
Java Driver tutorial to view instructions on adding the BOM to your
46+
application.
47+
4248
.. sharedinclude:: dbx/jvm/v5.4-wn-items.rst
4349

4450
.. replacement:: sort-option-link

0 commit comments

Comments
 (0)