Protocol Buffer: How to import?

偶尔善良 提交于 2019-12-06 07:37:10

The import statement is the folder relative to the place where you invoke protoc. It looks like you have treated it as relative to the package instead.

e.g. if (like me) you store both files in src/main/resources, you'd invoke protoc as follows:

protoc src/main/resources/firstFile.proto src/main/resources/secondFile.proto --java_out=src/generated/java

and your import statement would be import "src/main/resources/firstFile.proto"

If you want to store the files in subfolders according to package name, then you just add this accordingly, after the top-level foldername.

HTH

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!