How to import one google .proto into another using maven and java

Viewed 116

I'm trying to import one protobuff definition into another. I am using maven as a build tool. The plugin entry for the proto compiler is

<plugin>
      <groupId>com.github.os72</groupId>
      <artifactId>protoc-jar-maven-plugin</artifactId>
</plugin>

The import statement looks like

import "state/metadata.proto";

I understood the default location for .proto file in maven to be /src/main/proto.

My proto files are organized as shown below

%find . -name *.proto -print
./src/main/proto/config/PartitionSizeMapping.proto
./src/main/proto/config/Hosts.proto
./src/main/proto/messages/v1/RITServer.proto
./src/main/proto/state/metadata.proto

It is the RITServer.proto file that includes state/metadata.proto. When I build I get the following error

state/metadata.proto: File not found.
RITServer.proto: Import "state/metadata.proto" was not found or had errors.
RITServer.proto:41:3: "FileMetaData" is not defined.
[ERROR] /data/remote-image-transfer/common/src/main/proto/messages/v1/RITServer.proto [0:0]: state/metadata.proto: File not found.
[ERROR] /data/remote-image-transfer/common/src/main/proto/messages/v1/RITServer.proto [0:0]: RITServer.proto: Import "state/metadata.proto" was not found or had errors.
0 Answers
Related