报错信息:
grpc maven 编译 Error: java:: Tried to write the same file twice.
PROTOC FAILED: Account.proto:90:5: “Ret” is not defined.
引入其他proto时:
- 同目录使用 import “Enums.proto”;
- package要和被引入的相同
- 某个proto引入Enums.proto
syntax = "proto3";
import "Enums.proto";
option java_multiple_files = true;
option java_package = "com.company.strategy";
option java_outer_classname = "Strategy";
option objc_class_prefix = "company";
package strategy;
- Enums.proto
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.company.quantitative_trading_account";
option java_outer_classname = "Enums";
option objc_class_prefix = "company";
package strategy;
enum SubscribeType{
//占位
SubscribeType_ZERO = 0;
//订阅
SUBSCRIBE = 1;
//取消订阅
UNSUBSCRIBE = 2;
}
....
保持package相同,以及没有重复两个里头都写有相同message/enum即可编译通过