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

xuetaoli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git


The following commit(s) were added to refs/heads/main by this push:
     new 0e2d3a10 feat: Enhance dubbo-go cross test #837 (#960)
0e2d3a10 is described below

commit 0e2d3a10aa32d7671f5a1a7f496d69da5adc96fc
Author: 陈乐樂 <[email protected]>
AuthorDate: Wed Nov 19 09:56:34 2025 +0800

    feat: Enhance dubbo-go cross test #837 (#960)
    
    feat: Enhance dubbo-go cross test
---
 README.md                                          |  1 +
 helloworld/README.md                               | 72 +++++++++++++++--
 helloworld/README_zh.md                            | 71 ++++++++++++++++-
 helloworld/java-client/pom.xml                     | 72 +++++++++++++++++
 helloworld/java-client/run.sh                      |  3 +
 .../java/org/example/client/JavaClientApp.java     | 49 ++++++++++++
 helloworld/java-client/src/main/proto/greet.proto  | 36 +++++++++
 helloworld/java-server/pom.xml                     | 72 +++++++++++++++++
 helloworld/java-server/run.sh                      |  3 +
 .../java/org/example/server/JavaServerApp.java     | 55 +++++++++++++
 helloworld/java-server/src/main/proto/greet.proto  | 37 +++++++++
 helloworld/pom.xml                                 | 90 ++++++++++++++++++++++
 12 files changed, 552 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index c1d2e363..87b3d40d 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,7 @@
 * filter: Demonstrates the use of built-in and custom filters in Dubbo-go
   * polaris/limit: Use Polaris as tps limiter
 * healthcheck: Service health check example
+* helloworld: Basic Dubbo-Go and Java interoperability example
 * direct: Triple point-to-point invocation sample without registry
 * helloworld: Basic hello world example for Dubbo-go
 * integrate_test: Integration test cases for Dubbo-go samples
diff --git a/helloworld/README.md b/helloworld/README.md
index 7c7c1760..efe10d7d 100644
--- a/helloworld/README.md
+++ b/helloworld/README.md
@@ -1,11 +1,13 @@
 # Helloworld for dubbo-go
 
-This example demonstrates the basic usage of dubbo-go as an RPC framework. 
Check [Quick 
Start](https://dubbo.apache.org/zh-cn/overview/mannual/golang-sdk/quickstart/) 
on our official website for detailed explanation.
+This example demonstrates the basic usage of dubbo-go as an RPC framework,and 
shows Dubbo-Go with Java Interoperability. Check [Quick 
Start](https://dubbo.apache.org/zh-cn/overview/mannual/golang-sdk/quickstart/) 
on our official website for detailed explanation.
 
 ## Contents
 
 - go-server/cmd/main.go - is the main definition of the service, handler and 
rpc server
 - go-client/cmd/main.go - is the rpc client
+- java-server/src/main/java/org/example/server/JavaServerApp.java - is the 
Java server
+- java-client/src/main/java/org/example/client/JavaClientApp.java - is the 
Java client
 - proto - contains the protobuf definition of the API
 
 ## How to run
@@ -34,9 +36,10 @@ This example demonstrates the basic usage of dubbo-go as an 
RPC framework. Check
     ```shell
     protoc --go_out=. --go_opt=paths=source_relative --go-triple_out=. 
--go-triple_opt=paths=source_relative ./proto/greet.proto
     ```
+   
+4. Install `Maven` [Maven][]
 
-
-### Run server
+### Run Golang server
 ```shell
 go run ./go-server/cmd/main.go
 ```
@@ -49,11 +52,70 @@ curl \
     http://localhost:20000/greet.GreetService/Greet
 ```
 
-### Run client
+### Run Golang client
 ```shell
 go run ./go-client/cmd/main.go
 ```
 
-[Quick Start]: 
https://dubbo-next.staged.apache.org/zh-cn/overview/mannual/golang-sdk/quickstart/
+### Run Java server
+
+Build all Java modules from the root directory:
+```shell
+mvn clean compile
+```
+
+Run the Java server:
+
+**On Linux/Mac/Git Bash:**
+```shell
+cd java-server
+mvn exec:java -Dexec.mainClass=org.example.server.JavaServerApp
+```
+
+**On Windows PowerShell:**
+```powershell
+cd java-server
+mvn exec:java "-Dexec.mainClass=org.example.server.JavaServerApp"
+```
+
+**Or use the provided script (Linux/Mac):**
+```shell
+cd java-server
+./run.sh
+```
+
+Test server works as expected:
+```shell
+curl \
+    --header "Content-Type: application/json" \
+    --data '{"name": "Dubbo"}' \
+    http://localhost:20000/greet.GreetService/Greet
+```
+
+### Run Java client
+
+Run the Java client:
+
+**On Linux/Mac/Git Bash:**
+```shell
+cd java-client
+mvn exec:java -Dexec.mainClass=org.example.client.JavaClientApp
+```
+
+**On Windows PowerShell:**
+```powershell
+cd java-client
+mvn exec:java "-Dexec.mainClass=org.example.client.JavaClientApp"
+```
+
+**Or use the provided script (Linux/Mac):**
+```shell
+cd java-client
+./run.sh
+```
+## Attention
+Do NOT Start Go Server and Java Server at the Same Time. Both the Go server 
and Java server listen on the same port: 20000 and expose the same Triple 
service path:greet.GreetService/Greet
+
 [version3]: https://protobuf.dev/programming-guides/proto3/
 [Protocol Buffer Compiler Installation]: 
https://dubbo-next.staged.apache.org/zh-cn/overview/reference/protoc-installation/
+[Maven]: https://maven.apache.org/download.cgi
diff --git a/helloworld/README_zh.md b/helloworld/README_zh.md
index 5e0de008..b03af0ec 100644
--- a/helloworld/README_zh.md
+++ b/helloworld/README_zh.md
@@ -1,11 +1,13 @@
 # dubbo-go Helloworld 示例
 
-本示例演示了 dubbo-go 作为 RPC 
框架的基本用法。详细说明请参考[官方文档-快速开始](https://dubbo.apache.org/zh-cn/overview/mannual/golang-sdk/quickstart/)。
+本示例演示了 dubbo-go 作为 RPC 框架的基本用法,并展示了 Java ↔ Go 
之间的跨语言调用。详细说明请参考[官方文档-快速开始](https://dubbo.apache.org/zh-cn/overview/mannual/golang-sdk/quickstart/)。
 
 ## 目录结构
 
 - go-server/cmd/main.go - 服务端主程序,包含服务定义、处理器和 RPC 服务端
 - go-client/cmd/main.go - RPC 客户端
+- java-server/src/main/java/org/example/server/JavaServerApp.java - Java服务端
+- java-client/src/main/java/org/example/client/JavaClientApp.java - Java客户端
 - proto - API 的 protobuf 定义
 
 ## 运行方法
@@ -34,8 +36,10 @@
     ```shell
     protoc --go_out=. --go_opt=paths=source_relative --go-triple_out=. 
--go-triple_opt=paths=source_relative ./proto/greet.proto
     ```
+   
+4. 安装 `Maven` [Maven][]
 
-### 启动服务端
+### 启动Golang服务端
 ```shell
 go run ./go-server/cmd/main.go
 ```
@@ -48,11 +52,70 @@ curl \
     http://localhost:20000/greet.GreetService/Greet
 ```
 
-### 启动客户端
+### 启动Golang客户端
 ```shell
 go run ./go-client/cmd/main.go
 ```
 
+### 启动Java服务端
+
+从根目录构建所有 Java 模块:
+```shell
+mvn clean compile
+```
+
+启动 Java 服务端:
+
+**在 Linux/Mac/Git Bash 上:**
+```shell
+cd java-server
+mvn exec:java -Dexec.mainClass=org.example.server.JavaServerApp
+```
+
+**在 Windows PowerShell 上:**
+```powershell
+cd java-server
+mvn exec:java "-Dexec.mainClass=org.example.server.JavaServerApp"
+```
+
+**或使用提供的脚本(Linux/Mac):**
+```shell
+cd java-server
+./run.sh
+```
+
+测试服务端是否正常:
+```shell
+curl \
+    --header "Content-Type: application/json" \
+    --data '{"name": "Dubbo"}' \
+    http://localhost:20000/greet.GreetService/Greet
+```
+
+### 启动Java客户端
+
+启动 Java 客户端:
+
+**在 Linux/Mac/Git Bash 上:**
+```shell
+cd java-client
+mvn exec:java -Dexec.mainClass=org.example.client.JavaClientApp
+```
+
+**在 Windows PowerShell 上:**
+```powershell
+cd java-client
+mvn exec:java "-Dexec.mainClass=org.example.client.JavaClientApp"
+```
+
+**或使用提供的脚本(Linux/Mac):**
+```shell
+cd java-client
+./run.sh
+```
+## 注意
+不能同时启动 Go 和 Java 服务端,Go 服务端 和 Java 服务端 都监听 相同的端口:20000,并暴露 相同的 Triple 
服务路径:greet.GreetService/Greet
+
 [version3]: https://protobuf.dev/programming-guides/proto3/
 [Protocol Buffer Compiler 安装]: 
https://dubbo-next.staged.apache.org/zh-cn/overview/reference/protoc-installation/
-
+[Maven]: https://maven.apache.org/download.cgi
diff --git a/helloworld/java-client/pom.xml b/helloworld/java-client/pom.xml
new file mode 100644
index 00000000..9e778431
--- /dev/null
+++ b/helloworld/java-client/pom.xml
@@ -0,0 +1,72 @@
+<?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.example</groupId>
+        <artifactId>helloworld-parent</artifactId>
+        <version>1.0.0</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>java-greet-client</artifactId>
+    <name>java-greet-client</name>
+    <description>Java client module for helloworld</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.protobuf</groupId>
+            <artifactId>protobuf-java</artifactId>
+            <version>${protobuf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-stub</artifactId>
+            <version>${grpc.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-protobuf</artifactId>
+            <version>${grpc.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-netty-shaded</artifactId>
+            <version>${grpc.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.xolstice.maven.plugins</groupId>
+                <artifactId>protobuf-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <mainClass>org.example.client.JavaClientApp</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/helloworld/java-client/run.sh b/helloworld/java-client/run.sh
new file mode 100644
index 00000000..18af5dbc
--- /dev/null
+++ b/helloworld/java-client/run.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+mvn -q clean package
+mvn -q exec:java -Dexec.mainClass=org.example.client.JavaClientApp
diff --git 
a/helloworld/java-client/src/main/java/org/example/client/JavaClientApp.java 
b/helloworld/java-client/src/main/java/org/example/client/JavaClientApp.java
new file mode 100644
index 00000000..7eb158b3
--- /dev/null
+++ b/helloworld/java-client/src/main/java/org/example/client/JavaClientApp.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.example.client;
+
+import greet.GreetRequest;
+import greet.GreetResponse;
+import greet.GreetServiceGrpc;
+
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+
+public class JavaClientApp {
+
+    public static void main(String[] args) {
+
+        ManagedChannel channel = ManagedChannelBuilder
+                .forAddress("127.0.0.1", 20000)
+                .usePlaintext()
+                .build();
+
+        GreetServiceGrpc.GreetServiceBlockingStub client =
+                GreetServiceGrpc.newBlockingStub(channel);
+
+        GreetRequest req = GreetRequest.newBuilder()
+                .setName("Java Client")
+                .build();
+
+        GreetResponse resp = client.greet(req);
+
+        System.out.println("Response: " + resp.getGreeting());
+
+        channel.shutdown();
+    }
+}
diff --git a/helloworld/java-client/src/main/proto/greet.proto 
b/helloworld/java-client/src/main/proto/greet.proto
new file mode 100644
index 00000000..28982b54
--- /dev/null
+++ b/helloworld/java-client/src/main/proto/greet.proto
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+package greet;
+
+option go_package = "./greet";
+option java_package = "greet";
+option java_multiple_files = true;
+
+message GreetRequest {
+  string name = 1;
+}
+
+message GreetResponse {
+  string greeting = 1;
+}
+
+service GreetService {
+  rpc Greet(GreetRequest) returns (GreetResponse);
+}
diff --git a/helloworld/java-server/pom.xml b/helloworld/java-server/pom.xml
new file mode 100644
index 00000000..2d8853ce
--- /dev/null
+++ b/helloworld/java-server/pom.xml
@@ -0,0 +1,72 @@
+<?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.example</groupId>
+        <artifactId>helloworld-parent</artifactId>
+        <version>1.0.0</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>java-greet-server</artifactId>
+    <name>java-greet-server</name>
+    <description>Java server module for helloworld</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.protobuf</groupId>
+            <artifactId>protobuf-java</artifactId>
+            <version>${protobuf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-stub</artifactId>
+            <version>${grpc.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-protobuf</artifactId>
+            <version>${grpc.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-netty-shaded</artifactId>
+            <version>${grpc.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.xolstice.maven.plugins</groupId>
+                <artifactId>protobuf-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <mainClass>org.example.server.JavaServerApp</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/helloworld/java-server/run.sh b/helloworld/java-server/run.sh
new file mode 100644
index 00000000..acfc7a36
--- /dev/null
+++ b/helloworld/java-server/run.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+mvn -q clean package
+mvn -q exec:java -Dexec.mainClass=org.example.server.JavaGreetServer
diff --git 
a/helloworld/java-server/src/main/java/org/example/server/JavaServerApp.java 
b/helloworld/java-server/src/main/java/org/example/server/JavaServerApp.java
new file mode 100644
index 00000000..b47e2cc4
--- /dev/null
+++ b/helloworld/java-server/src/main/java/org/example/server/JavaServerApp.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package org.example.server;
+
+import greet.GreetRequest;
+import greet.GreetResponse;
+import greet.GreetServiceGrpc;
+
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+import io.grpc.stub.StreamObserver;
+
+public class JavaServerApp {
+
+    public static void main(String[] args) throws Exception {
+
+        Server server = ServerBuilder.forPort(20000)
+                .addService(new GreetServiceGrpc.GreetServiceImplBase() {
+
+                    @Override
+                    public void greet(GreetRequest request,
+                                      StreamObserver<GreetResponse> 
respObserver) {
+
+                        String name = request.getName();
+
+                        GreetResponse resp = GreetResponse.newBuilder()
+                                .setGreeting("Hello from Java Server, " + name)
+                                .build();
+
+                        respObserver.onNext(resp);
+                        respObserver.onCompleted();
+                    }
+                })
+                .build();
+
+        server.start();
+        System.out.println("Java Triple Server started on port 20000");
+        server.awaitTermination();
+    }
+}
diff --git a/helloworld/java-server/src/main/proto/greet.proto 
b/helloworld/java-server/src/main/proto/greet.proto
new file mode 100644
index 00000000..28b87265
--- /dev/null
+++ b/helloworld/java-server/src/main/proto/greet.proto
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+package greet;
+
+option go_package = 
"github.com/apache/dubbo-go-samples/helloworld/proto;greet";
+option java_package = "greet";
+option java_multiple_files = true;
+
+message GreetRequest {
+  string name = 1;
+}
+
+message GreetResponse {
+  string greeting = 1;
+}
+
+// gRPC/Dubbo-Triple
+service GreetService {
+  rpc Greet(GreetRequest) returns (GreetResponse);
+}
diff --git a/helloworld/pom.xml b/helloworld/pom.xml
new file mode 100644
index 00000000..c93e3c5b
--- /dev/null
+++ b/helloworld/pom.xml
@@ -0,0 +1,90 @@
+<?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";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.example</groupId>
+    <artifactId>helloworld-parent</artifactId>
+    <version>1.0.0</version>
+    <packaging>pom</packaging>
+    <name>helloworld-parent</name>
+    <description>Parent POM for helloworld project</description>
+
+    <modules>
+        <module>java-client</module>
+        <module>java-server</module>
+    </modules>
+
+    <properties>
+        <protobuf.version>3.21.7</protobuf.version>
+        <grpc.version>1.51.0</grpc.version>
+        <maven.compiler.source>11</maven.compiler.source>
+        <maven.compiler.target>11</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>javax.annotation-api</artifactId>
+            <version>1.3.2</version>
+        </dependency>
+    </dependencies>
+
+
+    <build>
+        <extensions>
+            <extension>
+                <groupId>kr.motd.maven</groupId>
+                <artifactId>os-maven-plugin</artifactId>
+                <version>1.7.0</version>
+            </extension>
+        </extensions>
+
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.xolstice.maven.plugins</groupId>
+                    <artifactId>protobuf-maven-plugin</artifactId>
+                    <version>0.6.1</version>
+                    <configuration>
+                        <!-- Windows平台protoc配置(可根据实际环境调整) -->
+                        <protocArtifact>
+                            
com.google.protobuf:protoc:${protobuf.version}:exe:windows-x86_64
+                        </protocArtifact>
+                        <pluginId>grpc-java</pluginId>
+                        <pluginArtifact>
+                            
io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:windows-x86_64
+                        </pluginArtifact>
+                        
<protoSourceRoot>${project.basedir}/src/main/proto</protoSourceRoot>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>compile</goal>
+                                <goal>compile-custom</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+</project>
\ No newline at end of file

Reply via email to