Play / sbt:代码更改时重新启动时始终编译的这 2 个 Scala 源代码是什么

Play / sbt: What are these 2 Scala sources that are always compiled on when restarting on Code change

每当我更改代码并且 Play 重新启动时,它总是会编译 2 个 Scala 源代码,例如:

[info] Compiling 2 Scala sources to /Users/mpa/dev/myplayproject/server/target/scala-2.13/classes ...

只有在我更改的源代码之后才能编译。

这两个来源是什么?

有什么办法可以避免这种情况吗?

根据 @cbley 的提示,我发现了问题 class:

BuildInfo.scala 来自 sbt-buldinfo 插件。默认情况下,它会在每个 compile 上创建一个新的时间戳,然后导致重新编译 BuildInfo.scala.

我实际上在 scoverage 上遇到了类似的问题 - 请参阅此处:

从那里添加接受的答案解决了问题:

lazy val buildTime: SettingKey[String] = SettingKey[String]

("buildTime", "time of build")

ThisBuild / buildTime := ZonedDateTime.now(ZoneOffset.UTC).toString

buildInfoKeys :=
  Seq[BuildInfoKey](
    name,
    version,
    scalaVersion,
    sbtVersion,
    buildTime
  )