You can create a task that deletes the file:
val removeCacheTask = TaskKey[Unit]("removeCacheFile", "Deletes a cache file")
val removeCacheSettings = removeCacheTask := {
import sys.process._
Seq("rm", "/path/to/file") !
}
Then require that the task be run before compilation by adding these settings to your project:
Project(...).settings(
removeCacheSettings,
compile in Compile <<= (compile in Compile).dependsOn(removeCacheTask)
)
Source: https://groups.google.com/forum/#!topic/play-framework/4DMWSTNM4kQ
In build.sbt
it would look like this:
lazy val removeCacheTask = TaskKey[Unit]("removeCacheFile", "Deletes a cache file")
removeCacheTask := {
import sys.process._
Seq("rm", "/path/to/file")!
}
compile in Compile <<= (compile in Compile).dependsOn(removeCacheTask)