[英]Maven and java: missing generated code for service in test directory
Following up on my question here , I noticed still some files are not created.在这里跟进我的问题,我注意到仍然没有创建一些文件。 The files not created are for the services.
未创建的文件用于服务。 The messages are created perfectly.
消息是完美创建的。
A quick example to reproduce my problem: clone for example this github repo .重现我的问题的快速示例:例如克隆这个 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
So the pom file should like this:所以 pom 文件应该是这样的:
It will create these java files correctly:它将正确创建这些 java 文件:
but missing the GreeterGrpc (which is the service, and was created when it was in src/main/proto):
但缺少 GreeterGrpc(这是服务,并且是在 src/main/proto 中创建的):
So I am wondering how I can make the java file for service to be created when proto file is moved to test folder.所以我想知道如何在 proto 文件移动到 test 文件夹时为要创建的服务创建 java 文件。
Actually I realized I had only added test-compile, but not test-compile-custom.实际上我意识到我只添加了 test-compile,但没有添加 test-compile-custom。 That was also needed for compiling the service java files.
这也是编译服务 java 文件所需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.