我正在尝试使用sbt multi-project配置新的 Scala 构建。我想使用sbt- protoc,特别是需要此配置设置的 ScalaPB:
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)
现在的问题是如何sbt.librarymanagement.Configurations.Compile
在多项目中正确应用该配置。我正在使用 Scala 2.13 和 sbt 1.4.7。
我的当前build.sbt
:
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)
lazy val commonSettings = List(
scalaVersion := scala212,
scalacOptions ++= Seq(
"utf8",
"-Ypartial-unification"
)
)
lazy val core = (project in file("core"))
.settings(
commonSettings,
name := "twirp4s-core",
crossScalaVersions := Seq(scala212, scala213),
libraryDependencies ++= Seq(
catsCore,
circeCore,
circeGeneric,
circeParser,
http4sDsl,
http4sCirce
),
addCompilerPlugin(betterMonadicForPlugin),
)
lazy val root = (project in file("."))
.aggregate(core)
.settings(
name := "twirp4s-root",
libraryDependencies += scalaTest % Test,
skip in publish := true
)
当我尝试编译我的项目时,编译器会说:
[info] Protobufs files found, but PB.targets is empty.