configurationsbtsubproject

SBT: how to override the default sources (and/or resources etc)?


I've been reading and re-reading the docs, and everywhere it just says that by default sbt uses the project base directory and src/main/scala to look for scala sources, but I could not find any mention of how that default can be changed.

I have seen vague references to an "exclude" filters, but what I need is the opposite.

I would like to compile a subset of a large scala project into a smaller self-contained artifact. Is there a way to tell sbt exactly what files I want it to include? Something like "**/util/*.scala" for example?


Solution

  • It is possible to customize sources path in SBT:

    scalaSource in Compile := baseDirectory.value / "src"
    scalaSource in Test := baseDirectory.value / "test-src"
    

    More in documentation.