1

我正在使用这个 scala protobuf 插件:https ://scalapb.github.io/

我遇到了一个问题,每次我运行“sbt clean”时,生成的 protobuf 文件也会被清理。

有什么办法可以配置插件,使 scalapb 的清理任务不是 sbt clean 任务的一部分?(又名“sbt clean”只会清理目标文件夹)

谢谢!任何帮助真的很感激!

4

1 回答 1

0

默认情况下,proto 生成到 target/src_managed。要自定义添加到 build.sbt:

// use  another source directory for proto because its cleaned in every compile
unmanagedSourceDirectories in Compile += baseDirectory.value / "com"

    // ScalaPB configuration
    PB.targets in Compile := {
      Seq(
        scalapb.gen(
          singleLineToString = true
        ) -> file(baseDirectory.value + "/src/main/com")
      )
    }
于 2017-05-08T11:09:35.340 回答