运行构建文件时出现bazel错误,协议错误,是吗?

时间:2017-06-27 14:55:17

标签: thrift bazel

通过bazel运行构建文件时面临以下错误

错误:/home/mywork1/...../X/service/tests/BUILD:47:11:在java_binary规则的deps属性中//javatests /.../X/service/tests:XHandler-测试:'//java/..../X/service:thrift-server'没有强制提供者'link_params'或'java_common.provider'和java_binary规则'//java/..../X/service :thrift-server'在这里放错位置(预期cc_binary,cc_library,genrule,genproto,java_import,java_library,java_proto_library,java_lite_proto_library,proto_library,sh_binary或sh_library)。

    'set regex input; if searching more than one column, combine into single string
    If ColNum > 0 Then
        For m = 0 To ColNum - 1
            strInput = strInput & Cells(i, ReadCol + m).Value
        Next
    Else
        strInput = Cells(i, ReadCol).Value
    End If

1 个答案:

答案 0 :(得分:1)

为了表现为Java库,规则需要提供某些信息。显然,thrift_java_libary没有。如果您是规则编写者,有Mapping Exposed Incoming Ports如何实现此功能。

但是,假设您只是使用Thrift规则并且不想修改它们:Thrift规则是否生成.jar文件作为输出?如果是这样,你可以这样做:

thrift_java_library(
 name = "XService",
 srcs = [
     "XService.thrift"        
 ],
)

java_import(
    name = "XServiceWrapper",
    jars = ["XService.jar"], # Replace this with the actual name of the thrift_library's output file
)

java_binary(
    ...
    deps = [":XServiceWrapper", ...],
)

您正在做的是手动将输出包装在与java_binary兼容的规则中。