![](/img/trans.png)
[英]Maven and java: how to generate code from protobuf files in test directory?
[英]Maven and java: missing generated code for service in test directory
在這里跟進我的問題,我注意到仍然沒有創建一些文件。 未創建的文件用於服務。 消息是完美創建的。
重現我的問題的快速示例:例如克隆這個 github repo 。
rm -rf src/main/java (remove java files to avoid other compilation issues)
mv src/main/proto src/test/proto (move the proto file to test)
add the following goal to pom for plugin maven-protoc-plugin: <goal>test-compile</goal>
mvn clean package
它將正確創建這些 java 文件: 但缺少 GreeterGrpc(這是服務,並且是在 src/main/proto 中創建的):
所以我想知道如何在 proto 文件移動到 test 文件夾時為要創建的服務創建 java 文件。
實際上我意識到我只添加了 test-compile,但沒有添加 test-compile-custom。 這也是編譯服務 java 文件所需要的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.