Wednesday, October 12, 2011

How to Exclude Scala/Java Source Files by Name in sbt

I thought this small tip would be useful to someone as I recently needed to do this and didn't know how to.

The project base directory is by default a source directory in addition to src/main/scala. You can exclude source files by name (butler.scala in the example below) like:

excludeFilter in unmanagedSources := "butler.scala"

Read more on How to exclude .scala source file in project folder - sbt Google Groups, also checkout Classpaths - sbt Wiki.

To learn more about Scala programming, I recommend Programming in Scala: A Comprehensive Step-by-Step Guide, 2nd Edition.