This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/master by this push:
new eb6fe0bd [Java] Build rocketmq-proto from submodule instead of
depending on Maven Central (#1287)
eb6fe0bd is described below
commit eb6fe0bd267b2d9a910cab1e6d4dcddfde61a17e
Author: lizhimins <[email protected]>
AuthorDate: Tue Jun 23 11:00:06 2026 +0800
[Java] Build rocketmq-proto from submodule instead of depending on Maven
Central (#1287)
---
.github/workflows/java_build.yml | 4 ++
.github/workflows/java_coverage.yml | 2 +
java/README-CN.md | 19 ++++++
java/README.md | 19 ++++++
java/pom.xml | 4 +-
java/proto/pom.xml | 122 ++++++++++++++++++++++++++++++++++++
protos | 2 +-
7 files changed, 169 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/java_build.yml b/.github/workflows/java_build.yml
index 0376f239..7a77aa75 100644
--- a/.github/workflows/java_build.yml
+++ b/.github/workflows/java_build.yml
@@ -13,6 +13,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
+ with:
+ submodules: recursive
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v3
with:
@@ -28,6 +30,8 @@ jobs:
steps:
- name: Checkout Current Repository
uses: actions/checkout@v3
+ with:
+ submodules: recursive
# Use JDK 21.
- name: Use JDK 21
uses: actions/setup-java@v3
diff --git a/.github/workflows/java_coverage.yml
b/.github/workflows/java_coverage.yml
index dc56e63a..c450874d 100644
--- a/.github/workflows/java_coverage.yml
+++ b/.github/workflows/java_coverage.yml
@@ -13,6 +13,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
+ with:
+ submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
diff --git a/java/README-CN.md b/java/README-CN.md
index e337ac48..5c7a7ef4 100644
--- a/java/README-CN.md
+++ b/java/README-CN.md
@@ -13,6 +13,25 @@
1. 准备 Java 环境。Java 8 是确保客户端运行的最小版本,Java 11 是确保客户端编译的最小版本;
2. 部署 namesrv,broker 以及
[proxy](https://github.com/apache/rocketmq/tree/develop/proxy) 组件。
+## 从源码构建
+
+`rocketmq-proto` 模块从 `protos/`
子模块([rocketmq-apis](https://github.com/apache/rocketmq-apis))编译,而非从 Maven
Central 下载。构建前需要先初始化子模块:
+
+```bash
+git submodule update --init protos
+```
+
+然后使用 Maven 构建:
+
+```bash
+cd java
+mvn -B package -DskipTests
+```
+
+构建顺序为:`proto`(从子模块编译)→ `client-apis` → `client` → `client-shade` → `test`。
+
+Proto 的版本号定义在 `protos/java/VERSION` 中,需要与 `java/proto/pom.xml` 的 `<version>`
保持一致。更新 proto 时,推进子模块并同步更新这两个文件。
+
## 快速开始
根据构建系统增加对应的客户端依赖,并将 `${rocketmq.version}`
替换成中央仓库中[最新的版本](https://search.maven.org/search?q=g:org.apache.rocketmq%20AND%20a:rocketmq-client-java)。
diff --git a/java/README.md b/java/README.md
index 095c5e82..7566228b 100644
--- a/java/README.md
+++ b/java/README.md
@@ -14,6 +14,25 @@ to [quick
start](https://rocketmq.apache.org/docs/quickStart/02quickstart/)).
1. Java 8+ for runtime, Java 11+ for the build;
2. Setup namesrv, broker, and
[proxy](https://github.com/apache/rocketmq/tree/develop/proxy).
+## Build from Source
+
+The `rocketmq-proto` module is compiled from the `protos/` submodule
([rocketmq-apis](https://github.com/apache/rocketmq-apis)) rather than
downloaded from Maven Central. Before building, initialize the submodule:
+
+```bash
+git submodule update --init protos
+```
+
+Then build with Maven:
+
+```bash
+cd java
+mvn -B package -DskipTests
+```
+
+The build order is: `proto` (from submodule) → `client-apis` → `client` →
`client-shade` → `test`.
+
+The proto version is defined in `protos/java/VERSION` and must match the
`<version>` in `java/proto/pom.xml`. When updating proto, advance the submodule
and update both files accordingly.
+
## Getting Started
Dependencies must be included in accordance with your build automation tools,
and replace the `${rocketmq.version}` with the [latest
version](https://search.maven.org/search?q=g:org.apache.rocketmq%20AND%20a:rocketmq-client-java).
diff --git a/java/pom.xml b/java/pom.xml
index c8313b8b..26991ddb 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -28,6 +28,7 @@
<packaging>pom</packaging>
<version>5.2.1</version>
<modules>
+ <module>proto</module>
<module>client-apis</module>
<module>client</module>
<module>client-shade</module>
@@ -48,7 +49,6 @@
~ 1. Whether it is essential, because the current shaded jar is
fat enough.
~ 2. Make sure that it is compatible with Java 8.
-->
- <rocketmq-proto.version>2.1.2</rocketmq-proto.version>
<annotations-api.version>1.3.5</annotations-api.version>
<protobuf.version>3.24.4</protobuf.version>
<grpc.version>1.50.0</grpc.version>
@@ -110,7 +110,7 @@
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-proto</artifactId>
- <version>${rocketmq-proto.version}</version>
+ <version>2.2.0</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
diff --git a/java/proto/pom.xml b/java/proto/pom.xml
new file mode 100644
index 00000000..3d6d86a6
--- /dev/null
+++ b/java/proto/pom.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.rocketmq</groupId>
+ <artifactId>rocketmq-client-java-parent</artifactId>
+ <version>5.2.1</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>rocketmq-proto</artifactId>
+ <!--
+ ~ This version is independent of the client version (${project.version}).
+ ~ It MUST match protos/java/VERSION in the rocketmq-apis submodule,
which is the
+ ~ authoritative source used by the Bazel-based release process
(assemble_maven).
+ ~
+ ~ When updating:
+ ~ 1. Advance the protos/ submodule to the target commit.
+ ~ 2. Set this version to match protos/java/VERSION.
+ ~ 3. Update the corresponding version in the parent POM's
dependencyManagement.
+ -->
+ <version>2.2.0</version>
+ <packaging>jar</packaging>
+ <name>Apache RocketMQ Proto (compiled from submodule)</name>
+ <description>
+ Compiles rocketmq-apis proto definitions from the protos/ submodule
+ into a Java JAR, removing the dependency on a pre-published Maven
artifact.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>${protobuf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-protobuf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-stub</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.annotation</groupId>
+ <artifactId>jakarta.annotation-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.7.1</version>
+ </extension>
+ </extensions>
+ <plugins>
+ <plugin>
+ <groupId>org.xolstice.maven.plugins</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ <version>0.6.1</version>
+ <configuration>
+
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
+ <pluginId>grpc-java</pluginId>
+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
+
<protoSourceRoot>${project.basedir}/../../protos</protoSourceRoot>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>compile-custom</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Skip checkstyle for generated proto code -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <!-- Skip spotbugs for generated proto code -->
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <!-- Skip jacoco for proto module -->
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/protos b/protos
index 68c2cc94..bc8e1845 160000
--- a/protos
+++ b/protos
@@ -1 +1 @@
-Subproject commit 68c2cc9442928f769f8938515a05af6fa05c9993
+Subproject commit bc8e1845a8b0a1b5ec828690324401a323244354