Overview
After looking around the internet for a while, I have not found a good way to omit certain folders from being watched by sbt 1.0.x
in a Play Framework application.
Solutions posted for older versions of sbt
:
- How to exclude a folder from compilation
- How to not watch a file for changes in Play Framework
- There are a few more, but all more or less the same.
And the release notes for 1.0.2
show that the +=
and ++=
behavior was maintained, but everything else was dropped.
- https://www.scala-sbt.org/1.x/docs/sbt-1.0-Release-Notes.html
- Source code verifies: https://www.scala-sbt.org/1.0.4/api/sbt/Watched$.html
Would love to see if anyone using sbt 1.0.x
has found a solution or workaround to this issue. Thanks!
Taking the approach of how SBT excludes
managedSources
fromwatchSources
I was able to omit a custom folder from being watched like so:Here we use
PathFinder
to get all the*.scala
sources fromdirectoryToExclude
:Then we create
customSourcesFilter
usingfilesToExclude
, which we then add to every currentWatchSource
:Note the above solution is just something that worked for me, that is, I do not know what is the recommend approach of solving this problem.