0

Whenever I change code and Play does a restart, it always compiles 2 Scala sources, like:

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

Only after that the sources I changed compiles.

What are these 2 Sources?

Is there a way this can be avoided?

pme
  • 14,156
  • 3
  • 52
  • 95

1 Answers1

0

With the tip of @cbley I found the problematic class:

BuildInfo.scala from the sbt-buldinfo Plugin. By default on every compile it creates a new timestamp, which then causes a recompile of BuildInfo.scala.

I actually had a similar problem with scoverage - see here: scoverage: Combine Coverage from test and it:test

Adding the accepted answer from there fixed the problem:

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
  )
pme
  • 14,156
  • 3
  • 52
  • 95