grpc-ecosystem / grpc-spring

Spring Boot starter module for gRPC framework.
https://grpc-ecosystem.github.io/grpc-spring/
Apache License 2.0
3.5k stars 823 forks source link

proto文件如何管理 #678

Open bli22ard opened 2 years ago

bli22ard commented 2 years ago

按照文档建议,proto为一个单独的interface项目,其他项目引入这个interface项目时候,这个interface项目是生成好grpc所需的java class文件,然后提交到maven仓库,还是把interface作为 git的 submodule 引入呢,这两种方式哪种更合理一些

ST-DDT commented 2 years ago

English

‐---------------

IMO you should build the interface project once and upload it to a maven repository. That way you have control about versioning it, and for the other developers it is just a library like any other.

Does that answer your question?

bli22ard commented 2 years ago

如果proto每次生成后提交到maven仓库, 那么开发过程中, 就需要先将proto 生成 jar , 上传到maven仓库,这样maven仓库就会有开发阶段的 proto 的jar,这样是不是不利于maven仓库的 jar 版本管理

ST-DDT commented 2 years ago

Why do you separate the proto files from the jar upload? Different distributors/team?

If you only need the jar for one project, then you can just build it as part of your project. If you need it multiple times, then you should add a build pipeline that builds and uploads it for you.

Storing it in maven saves you build time and config while it may have a dependency on specific protobuf and grpc version ranges due to internal API usage in the generated code. I never really had much issues with that though.

bli22ard commented 2 years ago

好的, 谢谢, 文档最佳实战, 可以补充这个方案进去