Search code examples
scalabuilddependency-managementregression-testing

SBT dependency management for build and test separetly


I need to add dependency in build.sbt file but this will be used only when running my regression-test. Is there a way to specify library dependency for just build, test or regression-test?

For your reference my project structure as

MyProject
 - app
 - conf
 - logs
 - target
 - test
 - test-regression
 - build.sbt

And right now I have dependency defined in build file as

libraryDependencies ++= Seq( .... )

Solution

  • So this is the way how you say that specs2 should be included only during tests:

    libraryDependencies ++= Seq(specs2 % Test)
    

    According to the manual:

    (...) means that specs2 will only be on the test classpath and it isn't needed by the main sources.

    It is described here: Per-configuration dependencies but you will have to dig to figure out how to make it more general.