如何将 "targets in compile" 添加到用 lazy val root = project.in(".") 定义的 SBT 项目中

How to add "targets in compile" to a SBT project which is defined with lazy val root = project.in(".")

我有一个项目:

lazy val root = project
  .in(file("."))
  .settings( ...

我希望将ScalaPB添加到项目中,我需要添加:

PB.targets in Compile := Seq(
    scalapb.gen(grpc = true) -> (sourceManaged in Compile).value,
    scalapb.zio_grpc.ZioCodeGenerator -> (sourceManaged in Compile).value,
)

如何将它添加到 lazy val 项目中?

这应该有效:

lazy val root = project
  .in(file("."))
  .settings(
    PB.targets in Compile := Seq(
      scalapb.gen(grpc = true) -> (sourceManaged in Compile).value,
      scalapb.zio_grpc.ZioCodeGenerator -> (sourceManaged in Compile).value
    )
  )