我有两个节俭文件:common.thrift
,proto.thrift
含量:
common.thrift
namespace java ru.domain.myserv.common
struct MyStruct {
1: i32 val
}
service MyServ {
1: MyStruct myStruct,
2: i32 val
}
proto.thrift
include "common.thrift"
namespace java ru.domain.myserv.proto
typedef ru.domain.myserv.common.MyServ MyServ
struct ProtoServ {
1: MyServ myServ
}
接下来,我运行thrift生成器:
thrift -r -out ../java --gen java proto.thrift
我在控制台中看到错误:
[ERROR:/path/proto.thrift:8] (last token was 'ru.domain.myserv.common.MyServ')
Type "ru.domain.myserv.common.MyServ" has not been defined.
我做错了什么?
答案 0 :(得分:2)
天哪啊。
我必须指定
typedef common.MyServ MyServ
而不是
typedef ru.domain.myserv.common.MyServ MyServ
但那么namesapace
是必要的吗?