Proto3:File Location - 文件位置

Prefer not to put .proto files in the same directory as other language sources. Consider creating a subpackage proto for .proto files, under the root package for your project.
如果不喜欢将.proto文件和其他语言资源放在同一个目录中。考虑在工程根包下为.proto文件创建一个子包proto。

Location Should be Language-agnostic

位置应与语言无关

When working with Java code, it's handy to put related .proto files in the same directory as the Java source. However, if any non-Java code ever uses the same protos, the path prefix will no longer make sense. So in general, put the protos in a related language-agnostic directory such as //myteam/mypackage.
使用Java代码时,将相关.proto文件和Java资源放在同一目录下是很方便的。然而,如何任何非Java代码使用相同proto,路径前缀将不再有意义。所以通常来说,将proto放入到与语言无关的目录中,如//myteam/mypackage.

The exception to this rule is when it's clear that the protos will be used only in a Java context, such as for testing.
这条规则的例外是当很明显原型将只在 Java 上下文中使用时,例如用于测试。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容