Reputation: 57
I am depending on a scala library, and within it's tests there is a mock object I'd like to use. I've currently just hand copied it into my projects test directory.
My question is: Is it possible to import the mock from test configuration of the library I'm using? (I've tried 'just importing' it but it could not find it in the compile step)
Upvotes: 0
Views: 438
Reputation: 11308
Yes, it's possible. You need to use an alternative ivy configuration mapping. This is how it looks like:
libraryDependencies += "org.scalatest" %% "scalatest" % "2.1.3" % "test->compile"
In this example, your project main ("compile") configuration will depend on ivy "test" configuration of your dependency. If you additionally want the standard dependency, you can spell it out like this:
libraryDependencies += "org.scalatest" %% "scalatest" % "2.1.3" % "test->compile;compile->compile"
See sbt documentation for more information.
Upvotes: 1