Java – in the new Use the compiled protobuf classes in the proto file

I imported a library containing classes generated by protobuf

I want to send this kind of object as part of other protobuf messages But protocol (obviously?) Complaint lack of definition:

Of course I can copy existing from the source code of the library Proto source code, but later I suspected that protoc would generate two versions of this class, which would be very annoying

Any idea how to solve this problem?

Solution

You need to import the existing proto class

import "somepath/existing_protobuf_library_class.proto"

Protocol will not generate additional code, and the generated java code will only import other assumed classes

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>