scalapb 如何从测试目录中的 protobuf 文件生成代码? [英] scalapb how to generate code from protobuf files in test directory?
本文介绍了scalapb 如何从测试目录中的 protobuf 文件生成代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从 test 目录中的 protobuf 文件生成代码.
I'd like to generate code from protobuf files in test directory.
project/test/protobuf/myproto.proto
这不起作用.
PB.targets in Test := Seq(
scalapb.gen() -> (sourceManaged in Test).value
)
scalapb 好像只在 main/protobuf 目录下为 protos 生成文件.
Looks like scalapb only generates files for protos in main/protobuf directory.
推荐答案
您需要为您的测试配置启用 ScalaPB 代码生成器.将此添加到 build.sbt
:
You need to enable ScalaPB code generator for your test configuration. Add this to build.sbt
:
Project.inConfig(Test)(sbtprotoc.ProtocPlugin.protobufConfigSettings)
这篇关于scalapb 如何从测试目录中的 protobuf 文件生成代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文