Project Setup

Modules and Artifacts

Dispatch is divided into a number of modules so that client applications need only depend on the parts of Dispatch they use. Some of the modules depend on other modules, and dependencies managers will add these transitive dependencies automatically.

Each module is cross-built against several versions of Scala and published to the scala-tools repository with the organization-id “net.databinder”. The modules have the Scala version they are built against appended. For Scala 2.10.2, the full artifact names are as follows:

Source Dependencies

Because each web API and third party Scala library has its own release timeline, some modules are not part of the main Dispatch build and distribution. Instead, they are external modules hosted on github and tagged for release as needed.

Since these modules are build from source, binary compatibility with Scala and Dispatch versions is not an issue. More importantly, they can be trivially initted, forked, and used by anyone.

If a module is lacking an API method that you need right now, you can fork it, fix it, tag it, and push it without waiting on anyone else. At that point it’s “released” under your name. You should also fork this documentation to add your integration module to the list:

Build Tools

Configuring sbt Projects

When using sbt with Scala binary dependencies, it’s best to have the Scala version automatically appended so it will always match your project’s. In a sbt 0.11.x build.sbt:

libraryDependencies ++= Seq(
  "net.databinder" %% "dispatch-http" % "0.8.10"
)

To use source dependencies with sbt, create a project build such as project/build.scala. This is an example using dispatch-lift-json:

import sbt._
object MyApp extends Build
{
  lazy val root =
    Project("root", file(".")) dependsOn(dispatchLiftJson)
  lazy val dispatchLiftJson =
    uri("git://github.com/dispatch/dispatch-lift-json#0.1.0")
}

The Twine example application uses both source and binary Dispatch dependencies in its sbt project.

Maven

With Maven, you can depend on Dispatch’s binary modules by specifying the full artifact id with Scala version:

<dependency>
  <groupId>net.databinder</groupId>
  <artifactId>dispatch-http_2.10.2</artifactId>
  <version>0.8.10</version>
</dependency>

To use source dependencies with Maven, your best bet is to check out the project as a submodule.

Fork me on GitHub