Merge branch '1.0' of https://github.com/fansofml/dubbo-go-samples into 1.0
diff --git a/java_interop/protobuf-triple/README.md b/java_interop/protobuf-triple/README.md
index 2f93bd5..f10324f 100644
--- a/java_interop/protobuf-triple/README.md
+++ b/java_interop/protobuf-triple/README.md
@@ -10,6 +10,58 @@
- [x] java-client communicating with a dubbogo-server
- [x] java-server communicating with a dubbogo-client
+## Generating Code
+- Java
+ - 1.Add build to pom.xml
+ ```xml
+ <build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.6.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:3.19.4:exe:${os.detected.classifier}</protocArtifact>
+ <outputDirectory>${project.basedir}/../build/protobuf/java</outputDirectory>
+ <protocPlugins>
+ <protocPlugin>
+ <id>dubbo</id>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-compiler</artifactId>
+ <version>${dubbo.version}</version>
+ <mainClass>org.apache.dubbo.gen.tri.Dubbo3TripleGenerator</mainClass>
+ </protocPlugin>
+ </protocPlugins>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ ```
+ - 2.Generate using mvn
+ ```shell
+ mvn clean install
+ ```
+- go
+ - Generate code with protoc
+ ```shell
+ protoc --go_out=. --go_opt=paths=source_relative --go-triple_out=. greet.proto
+ ```
+
+
## Running the Application
1. Start the server:
- Use goland to start triple/gojava-go-server
diff --git a/java_interop/protobuf-triple/README_zh.md b/java_interop/protobuf-triple/README_zh.md
index 01fbd57..af369f3 100644
--- a/java_interop/protobuf-triple/README_zh.md
+++ b/java_interop/protobuf-triple/README_zh.md
@@ -1,5 +1,6 @@
# dubbogo-java
+使用同一个proto文件实现dubbo的java和go互通
## Contents
- protobuf: 使用 proto 文件的结构体定义
@@ -11,7 +12,57 @@
- [x] java-client -> dubbogo-server
- [x] java-server -> dubbogo-client
-
+## 生成 code
+- java
+ - 1.在pom.xml中添加build
+ ```xml
+ <build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.6.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:3.19.4:exe:${os.detected.classifier}</protocArtifact>
+ <outputDirectory>${project.basedir}/../build/protobuf/java</outputDirectory>
+ <protocPlugins>
+ <protocPlugin>
+ <id>dubbo</id>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-compiler</artifactId>
+ <version>${dubbo.version}</version>
+ <mainClass>org.apache.dubbo.gen.tri.Dubbo3TripleGenerator</mainClass>
+ </protocPlugin>
+ </protocPlugins>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ ```
+ - 2.使用mvn生成
+ ```shell
+ mvn clean install
+ ```
+- go
+ - 使用protoc生成code
+ ```shell
+ protoc --go_out=. --go_opt=paths=source_relative --go-triple_out=. greet.proto
+ ```
+
## 运行
1. 启动服务端
- 使用 goland 启动 triple/gojava-go-server
diff --git a/java_interop/protobuf-triple/go/go-client/cmd/client.go b/java_interop/protobuf-triple/go/go-client/cmd/client.go
index acf859e..c833592 100644
--- a/java_interop/protobuf-triple/go/go-client/cmd/client.go
+++ b/java_interop/protobuf-triple/go/go-client/cmd/client.go
@@ -34,13 +34,6 @@
if err != nil {
panic(err)
}
- if err != nil {
- panic(err)
- }
-
- if err != nil {
- panic(err)
- }
svc, err := greet.NewGreeter(cli)
if err != nil {
diff --git a/java_interop/protobuf-triple/java/java-client/pom.xml b/java_interop/protobuf-triple/java/java-client/pom.xml
index ae5cb3d..e5079a0 100644
--- a/java_interop/protobuf-triple/java/java-client/pom.xml
+++ b/java_interop/protobuf-triple/java/java-client/pom.xml
@@ -51,6 +51,7 @@
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
+ <outputDirectory>${project.basedir}/../build/protobuf/java</outputDirectory>
<version>0.6.1</version>
<configuration>
<!--suppress UnresolvedMavenProperty -->
diff --git a/java_interop/protobuf-triple/java/java-server/pom.xml b/java_interop/protobuf-triple/java/java-server/pom.xml
index 3f7a7a6..8a52a99 100644
--- a/java_interop/protobuf-triple/java/java-server/pom.xml
+++ b/java_interop/protobuf-triple/java/java-server/pom.xml
@@ -51,6 +51,7 @@
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
+ <outputDirectory>${project.basedir}/../build/protobuf/java</outputDirectory>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.19.4:exe:${os.detected.classifier}</protocArtifact>
diff --git a/java_interop/protobuf-triple/java/pom.xml b/java_interop/protobuf-triple/java/pom.xml
index 3f7a7a6..8a52a99 100644
--- a/java_interop/protobuf-triple/java/pom.xml
+++ b/java_interop/protobuf-triple/java/pom.xml
@@ -51,6 +51,7 @@
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
+ <outputDirectory>${project.basedir}/../build/protobuf/java</outputDirectory>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.19.4:exe:${os.detected.classifier}</protocArtifact>