@@ -70,6 +70,50 @@ its dependencies in your development environment.
70
70
or `Creating New Gradle Builds <https://guides.gradle.org/creating-new-gradle-builds/>`__
71
71
to learn how to set up your project.
72
72
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
+
73
117
.. step:: Install the {+driver-short+}
74
118
75
119
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.
81
125
<dependency>
82
126
<groupId>org.mongodb</groupId>
83
127
<artifactId>mongodb-driver-sync</artifactId>
84
- <version>{+full-version+}</version>
85
128
</dependency>
86
129
</dependencies>
87
130
@@ -90,13 +133,17 @@ its dependencies in your development environment.
90
133
.. code-block:: groovy
91
134
92
135
dependencies {
93
- implementation 'org.mongodb:mongodb-driver-sync:{+full-version+} '
136
+ implementation 'org.mongodb:mongodb-driver-sync'
94
137
}
95
138
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
+
96
143
After you configure your dependencies, ensure they are available to your
97
144
project by running your dependency manager and refreshing
98
145
the project in your IDE.
99
-
146
+
100
147
After you complete these steps, you have a new project
101
148
and the driver dependencies installed.
102
149
@@ -247,4 +294,4 @@ visiting the following guides:
247
294
- :ref:`java-db-coll`: Learn more about interacting with
248
295
MongoDB databases and collections.
249
296
- :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+}.
0 commit comments