【发布时间】:2020-07-20 13:09:04
【问题描述】:
我有 2 个 protobuf 文件文件 -
file1.proto
**package abcd.xyz**
message Msg1{
uint32 id =1;
string name = 2;
}
file2.proto
**package com.abcd.xyz**
import "abcd/xyz/Msg1.proto";
message Msg2{
uint32 id =1;
string name = 2;
Msg1 msg = 3;
}
当我编译这个时,得到以下错误 -
[exec] com/abcd/xyz/Msg2.proto:5: "abcd.xyz.Msg1" is resolved to "com.abcd.xyz.Msg1", which is not defined. The innermost scope is searched first in name resolution. Consider using a leading '.'(i.e., ".abcd.xyz.Msg1") to start from the outermost scope.
Msg1.proto 文件在多个地方使用,我无法更改它的包。
知道在不更改包名的情况下编译 Msg2.proto 文件需要做哪些更改吗?
【问题讨论】:
标签: java protocol-buffers grpc