Installation

There are 3 preferred ways to install specs2:

SBT

First you need to install sbt itself then you need to add the following dependency:

libraryDependencies += "org.specs2" %% "specs2-core" % "4.10.0" % "test"

scalacOptions in Test ++= Seq("-Yrangepos")

See here to learn more about sbt dependencies.

Maven

You can install Maven from there. Once installed, you need to create a pom.xml file with the maven-scala-plugin. In the pom.xml file you can add the following dependency:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  ...
<dependencies>
  <dependency>
    <groupId>org.specs2</groupId>
    <artifactId>specs2-core_2.12</artifactId>
    <version>4.10.0</version>
    <scope>test</scope>
  </dependency>
</dependencies>
  ...
</project>

Gradle

Go to this page to install Gradle. You then need to install the Scala plugin and add the following to your build.gradle file:

repositories {
  maven {
     url "https://oss.sonatype.org/content/repositories/releases"
  }
}

dependencies {
  testCompile "org.specs2:specs2-core_2.12:4.10.0"
}

Other dependencies

Depending on the specs2 features you want to use you will need to add more dependencies to your build:

Name Functionality
specs2-matcher-extra for the optional specs2 matchers
specs2-cats for the cats matchers (only for cats < 0.8.x)
specs2-scalaz for the scalaz matchers (TaskMatcher for example)
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-html to export specifications as html
specs2-form to create html form-like specifications
specs2-junit to run specifications as JUnit tests

Note: the specs2-core jar depends on 2 other specs2 jars:

Name Functionality
specs2-common utility classes for text, collections, xml,…
specs2-matcher common specs2 matchers. They can be used as a stand-alone library with JUnit