dsdvr06648 2019-06-04 06:38
浏览 123

为使用gogradle构建的go程序添加protobuf支持

I want to integrate protobuf support into my go code, but cannot figure out how to integrate it using gogradle

I want to integrate protobuf support into my go code, and am using gogradle as a build tool. I do not want to install protoc/protoc-gen-go on my machine, I want to all dependencies to be resolved when I run ./gradlew goBuild. Presently I am looking at https://github.com/innobead/gogradle/blob/5636bd09c701743b65f5da295cf28b6515b8c0bf/README.md but cannot figure out where the grpc tag would go. I tried putting it in the build.gradle file:

....

task grpc() {
        // Protobuf schemas root folder. Default: file("proto")
        protoDir = file("$projectDir/metriclibrary/publish/proto")

        // Append the module path as prefix path of below packages when referenced in other protobuf gnerated stub go files
        referencePackages = []
}

dependencies {
...
    golang {
            build 'github.com/golang/protobuf@v1.2.0'
            build 'google.golang.org/grpc@v1.14.0'

    }

}



.....

goGrpc.dependsOn grpc

OUTPUT:

Configuration on demand is an incubating feature.

Configure project :agt Found go 1.12 in /usr/local/go/bin/go, use it.

FAILURE: Build failed with an exception.

  • Where: Build file '...../build.gradle' line: 43

  • What went wrong: A problem occurred evaluating project ':agt'.

    Could not set unknown property 'protoDir' for task ':agt' of type org.gradle.api.DefaultTask.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大