Hi all,
This is a note tell everyone about specs2 dependencies and how to solve some issues which have been tripping lots of people up recently.
1. Fine-grained modules
Since specs2 2.3 (around one year ago), the project has been split into finer-grained modules:
- `specs2-core`: for simple specifications executable in the console or with sbt
- `specs2-matcher`: to use specs2 matchers with JUnit
- `specs2-matcher-extra`: for the optional specs2 matchers (add `"bintray" at "http://dl.bintray.com/scalaz/releases"` to your resolvers)
- `specs2-scalacheck`: to use ScalaCheck properties in specifications
- `specs2-mock`: to use Mockito matchers
- `specs2-analysis`: to use the package dependencies matcher
- `specs2-gwt`: to write given-when-then specifications
- `specs2-form`: Fit-like forms
- `specs2-html`: to export specifications as html
- `specs2-junit`: to run specifications as JUnit tests
The purpose of this split is to help you manage your dependencies because not all modules have the same requirements. For example `specs2-gwt` uses Shapeless and `specs2-core` doesn't use it.
Generally you need to start with:
- `specs2-core`: for basic specifications
- `specs2-junit`: for a CI integration (to produce junitxml reports)
So you are encouraged to use those modules instead of using the full `specs2.jar` which will bring all dependencies with it, augmenting the chances of conflicts.
2. Scalaz
specs2 (and specs2-core) depends on Scalaz 7.1.0 by default but your project might require Scala 7.0.6 which is binary incompatible. In this case you need to depend on `specs2-core-scalaz-7.0.6` (same scheme for the other modules).
3. Scalaz-stream
Since 2.4.3, new matchers for `scalaz.concurrent.Task` and `scalaz.stream.Process` have been added to `specs2-matcher-extra`. They require a dependency on `"org.scalaz.stream" %% "scalaz-stream" % "0.5a"` (and `"org.scalaz.stream" %% "scalaz-stream" % "0.5"` if you are using Scalaz 7.0.6). However those jars are not available on Maven Central so you need to add
`"bintray" at "http://dl.bintray.com/scalaz/releases"` to your resolvers in the sbt build file.
Again, note that you will side-step this issue entirely if you depend on fine-grained jars instead of the full specs2 jar (and if you don't use specs2-matcher-extra of course).
I hope this helps,
Eric.