This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
     new ee11559a50d5  [feat][doc] show how to use Pulsar BOM with Java client 
(#874)
ee11559a50d5 is described below

commit ee11559a50d5e8ddd0f32e5e68cfd9d214724813
Author: Chris Bono <[email protected]>
AuthorDate: Mon Apr 1 22:47:09 2024 -0500

     [feat][doc] show how to use Pulsar BOM with Java client (#874)
---
 docs/client-libraries-java-setup.md                | 47 +++++++++++++++++++++-
 docs/client-libraries-java.md                      |  2 +-
 .../version-3.2.x/client-libraries-java-setup.md   | 47 +++++++++++++++++++++-
 3 files changed, 91 insertions(+), 5 deletions(-)

diff --git a/docs/client-libraries-java-setup.md 
b/docs/client-libraries-java-setup.md
index 0094deb11e93..2086c771820a 100644
--- a/docs/client-libraries-java-setup.md
+++ b/docs/client-libraries-java-setup.md
@@ -42,10 +42,53 @@ If you use Gradle, add the following information to the 
`build.gradle` file.
 def pulsarVersion = '@pulsar:version@'
 
 dependencies {
-    compile group: 'org.apache.pulsar', name: 'pulsar-client', version: 
pulsarVersion
+       implementation "org.apache.pulsar:pulsar-client:${pulsarVersion}"
 }
 ```
 
+### Pulsar BOM
+
+While the above dependencies are sufficient to obtain the Pulsar Java client, 
it is recommended to also use the [Pulsar 
BOM](https://github.com/apache/pulsar/blob/master/pip/pip-326.md) to ensure 
that all Pulsar dependencies (both direct and transitive) are at the same 
expected version.
+In order to use the BOM, the previous directions are modified slightly as 
follows:
+
+#### Maven
+
+If you use Maven, add the following information to the `pom.xml` file.
+
+```xml
+<!-- in your <properties> block -->
+<pulsar.version>@pulsar:version@</pulsar.version>
+
+<!-- in your <dependencyManagement>/<dependencies> block -->
+<dependency>
+  <groupId>org.apache.pulsar</groupId>
+  <artifactId>pulsar-bom</artifactId>
+  <version>${pulsar.version}</version>
+  <type>pom</type>
+  <scope>import</scope>
+</dependency>
+
+<!-- in your <dependencies> block -->
+<dependency>
+  <groupId>org.apache.pulsar</groupId>
+  <artifactId>pulsar-client</artifactId>
+</dependency>
+```
+
+#### Gradle
+
+If you use Gradle, add the following information to the `build.gradle` file.
+
+```groovy
+def pulsarVersion = '@pulsar:version@'
+
+dependencies {
+  implementation 
enforcedPlatform("org.apache.pulsar:pulsar-bom:${pulsarVersion}")
+  implementation 'org.apache.pulsar:pulsar-client'
+}
+```
+Note that the version is number for the `pulsar-client` dependency is now 
omitted as the Pulsar BOM dictates which version is used.
+
 ## Step 2: Connect to Pulsar cluster
 
 To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
@@ -66,4 +109,4 @@ If you use [mTLS](security-tls-authentication.md) 
authentication, add `+ssl` in
 
 ```http
 pulsar+ssl://pulsar.us-west.example.com:6651
-```
\ No newline at end of file
+```
diff --git a/docs/client-libraries-java.md b/docs/client-libraries-java.md
index f536f5273b10..c71740334b5c 100644
--- a/docs/client-libraries-java.md
+++ b/docs/client-libraries-java.md
@@ -37,4 +37,4 @@ Package | Description | Maven Artifact
 
 - [Java client 
configurations](pathname:///reference/#/@pulsar:version_reference@/client/)
 - [Release notes](/release-notes/client-java)
-- [Client feature matrix](/client-feature-matrix/)
\ No newline at end of file
+- [Client feature matrix](/client-feature-matrix/)
diff --git a/versioned_docs/version-3.2.x/client-libraries-java-setup.md 
b/versioned_docs/version-3.2.x/client-libraries-java-setup.md
index 0094deb11e93..6f6acc40c40a 100644
--- a/versioned_docs/version-3.2.x/client-libraries-java-setup.md
+++ b/versioned_docs/version-3.2.x/client-libraries-java-setup.md
@@ -42,10 +42,53 @@ If you use Gradle, add the following information to the 
`build.gradle` file.
 def pulsarVersion = '@pulsar:version@'
 
 dependencies {
-    compile group: 'org.apache.pulsar', name: 'pulsar-client', version: 
pulsarVersion
+    implementation "org.apache.pulsar:pulsar-client:${pulsarVersion}"
 }
 ```
 
+### Pulsar BOM
+
+While the above dependencies are sufficient to obtain the Pulsar Java client, 
it is recommended to also use the [Pulsar 
BOM](https://github.com/apache/pulsar/blob/master/pip/pip-326.md) to ensure 
that all Pulsar dependencies (both direct and transitive) are at the same 
expected version.
+In order to use the BOM, the previous directions are modified slightly as 
follows:
+
+#### Maven
+
+If you use Maven, add the following information to the `pom.xml` file.
+
+```xml
+<!-- in your <properties> block -->
+<pulsar.version>@pulsar:version@</pulsar.version>
+
+<!-- in your <dependencyManagement>/<dependencies> block -->
+<dependency>
+  <groupId>org.apache.pulsar</groupId>
+  <artifactId>pulsar-bom</artifactId>
+  <version>${pulsar.version}</version>
+  <type>pom</type>
+  <scope>import</scope>
+</dependency>
+
+<!-- in your <dependencies> block -->
+<dependency>
+  <groupId>org.apache.pulsar</groupId>
+  <artifactId>pulsar-client</artifactId>
+</dependency>
+```
+
+#### Gradle
+
+If you use Gradle, add the following information to the `build.gradle` file.
+
+```groovy
+def pulsarVersion = '@pulsar:version@'
+
+dependencies {
+  implementation 
enforcedPlatform("org.apache.pulsar:pulsar-bom:${pulsarVersion}")
+  implementation 'org.apache.pulsar:pulsar-client'
+}
+```
+Note that the version is number for the `pulsar-client` dependency is now 
omitted as the Pulsar BOM dictates which version is used.
+
 ## Step 2: Connect to Pulsar cluster
 
 To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
@@ -66,4 +109,4 @@ If you use [mTLS](security-tls-authentication.md) 
authentication, add `+ssl` in
 
 ```http
 pulsar+ssl://pulsar.us-west.example.com:6651
-```
\ No newline at end of file
+```

Reply via email to