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文件和其他語言資源放在同一個(gè)目錄中??紤]在工程根包下為.proto文件創(chuàng)建一個(gè)子包proto。
Location Should be Language-agnostic
位置應(yīng)與語言無關(guān)
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代碼時(shí),將相關(guān).proto文件和Java資源放在同一目錄下是很方便的。然而,如何任何非Java代碼使用相同proto,路徑前綴將不再有意義。所以通常來說,將proto放入到與語言無關(guān)的目錄中,如//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.
這條規(guī)則的例外是當(dāng)很明顯原型將只在 Java 上下文中使用時(shí),例如用于測(cè)試。