scalapb how to generate code from protobuf files i

2019-08-27 17:47发布

I'd like to generate code from protobuf files in test directory.

project/test/protobuf/myproto.proto

This doesn't work.

PB.targets in Test := Seq(
  scalapb.gen() -> (sourceManaged in Test).value
)

Looks like scalapb only generates files for protos in main/protobuf directory.

1条回答
戒情不戒烟
2楼-- · 2019-08-27 18:25

You need to enable ScalaPB code generator for your test configuration. Add this to build.sbt:

Project.inConfig(Test)(sbtprotoc.ProtocPlugin.protobufConfigSettings)
查看更多
登录 后发表回答