build - How do I specify a custom directory layout for an sbt project? -


how specify custom directory layout sbt-based project? i've been looking @ online sbt material, i'm struggling find information...

what did find in documentation default locations:

  • sources in base directory
  • sources in src/main/scala , src/main/java
  • tests in src/test/scala , src/test/java
  • data files in src/main/resources , src/test/resources
  • unmanaged jar-files in lib/

how override these in build.sbt file?

my project structure follows:

  • source in: [workspace]/sandbox-scala/src/sbt/myfirst/
  • libraries in: [workspace]/java-lib/common/lib/

any appreciated.

one can override number of sbt's default directory locations. here's example overrides directory sbt expects find "unmanaged" dependencies/jar files:

unmanagedbase := basedirectory.value / "custom-jars-directory" 

(more examples related depndencies in the sbt documentation.)

you can configure directories specific particular "task"... e.g., set directory test-case source code is, try:

scalasource in test := { (basedirectory in test)(_ / "test") }.value 

and core application source code somewhere else, under src/:

scalasource in compile := { (basedirectory in compile)(_ / "src") }.value 

note: older versions of sbt may need following (now-deprecated) syntax:

unmanagedbase <<= basedirectory { base => base / "custom-jars-directory" } scalasource in compile <<= (basedirectory in compile)(_ / "src") 

this syntax not work in newer versions of sbt (since 0.13.13, believe).


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -