Skip to content

Commit

Permalink
Improve protobuf and grpc dependency management (apache#8371)
Browse files Browse the repository at this point in the history
### Motivation

For managing protobuf libraries there is a maven bom file available for protobuf. The benefit of using this is that it can be imported to the project's pom.xml dependency management to make sure that the versions of the various protobuf libraries are aligned and use the same version.

Besides starting to use protobuf-bom, it was noticed that there are separate settings for protobuf protoc version (`protoc3.version`) and the protoc grpc plugin versions (`protoc-gen-grpc-java.version`). These versions should match the protobuf and grpc versions. The PR also covers an improvement for that.

One motivation of this PR is to prepare for the grpc upgrade that was attempted by apache#8351 , but reverted. Before doing the grpc upgrade, it would be useful to improve the protobuf & grpc dependency management provided by this PR.

### Modifications

* Use protobuf-bom to manage protobuf library versions
* make `protoc3.version` match `protobuf3.version`
  * there should be no reason that these would be different
* make grpc's `protoc-gen-grpc-java.version` match `grpc.version`
  * there should be no reason that there would be different
  • Loading branch information
lhotari authored and huangdx0726 committed Nov 13, 2020
1 parent 32a12d7 commit 1158c77
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion managed-ledger/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
</dependency>

<dependency>
Expand Down
12 changes: 10 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ flexible messaging model and an intuitive client API.</description>
<typetools.version>0.5.0</typetools.version>
<protobuf2.version>2.4.1</protobuf2.version>
<protobuf3.version>3.11.4</protobuf3.version>
<protoc3.version>3.11.4</protoc3.version>
<protoc3.version>${protobuf3.version}</protoc3.version>
<grpc.version>1.18.0</grpc.version>
<protoc-gen-grpc-java.version>1.12.0</protoc-gen-grpc-java.version>
<protoc-gen-grpc-java.version>${grpc.version}</protoc-gen-grpc-java.version>
<gson.version>2.8.2</gson.version>
<sketches.version>0.8.3</sketches.version>
<hbc-core.version>2.2.0</hbc-core.version>
Expand Down Expand Up @@ -803,6 +803,14 @@ flexible messaging model and an intuitive client API.</description>
<version>${grpc.version}</version>
</dependency>

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>${protobuf3.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand Down
1 change: 0 additions & 1 deletion pulsar-broker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
</dependency>

<dependency>
Expand Down
1 change: 0 additions & 1 deletion pulsar-client-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
1 change: 0 additions & 1 deletion pulsar-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
<scope>provided</scope>
</dependency>

Expand Down
2 changes: 0 additions & 2 deletions pulsar-functions/proto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
</dependency>

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf3.version}</version>
</dependency>

<dependency>
Expand Down
4 changes: 1 addition & 3 deletions pulsar-transaction/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
</dependency>

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf3.version}</version>
</dependency>

</dependencies>
Expand All @@ -69,4 +67,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
1 change: 0 additions & 1 deletion tiered-storage/file-system/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
</dependency>

<dependency>
Expand Down

0 comments on commit 1158c77

Please sign in to comment.