简体   繁体   中英

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 .

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: 在此处输入图片说明

It will create these java files correctly: 在此处输入图片说明 but missing the GreeterGrpc (which is the service, and was created when it was in 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.

Actually I realized I had only added test-compile, but not test-compile-custom. That was also needed for compiling the service java files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM