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文件和其他語言資源放在同一個(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è)試。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容