Skip to content

Integrating phantom in your project

Flavian Alexandru edited this page Jan 30, 2017 · 20 revisions

back to top

The resolvers needed for Phantom are the Typesafe defaults, Sonatype, Twitter and our very own. The below list should make sure you have no dependency resolution errors.

resolvers ++= Seq(
  Resolver.typesafeRepo("releases"),
  Resolver.sonatypeRepo("releases")
)

For must things, all you need is a dependency on the phantom-dsl module.

For most things, all you need is the main phantom-dsl module. This will bring in the default module with all the query generation ability, as well as phantom-connectors and database objects that help you manage your entire database layer on the fly. All other modules implement enhanced integration with other tools, but you don't need them to get started.

libraryDependencies ++= Seq(
  "com.outworkers"  %% "phantom-dsl"                   % phantomVersion
)

The full list of available modules

The full list of available modules is:

libraryDependencies ++= Seq(
  "com.outworkers"   %% "phantom-connectors"            % phantomVersion,
  "com.outworkers"   %% "phantom-dsl"                   % phantomVersion,
  "com.outworkers"   %% "phantom-example"               % phantomVersion,
  "com.outworkers"   %% "phantom-finagle"               % phantomVersion,
  "com.outworkers"   %% "phantom-jdk8"                  % phantomVersion,
  "com.outworkers"   %% "phantom-thrift"                % phantomVersion,
  "com.outworkers"   %% "phantom-streams"               % phantomVersion,
  "com.outworkers"   %% "phantom-sbt"                   % phantomVersion
)

If you include phantom-finagle, make sure to add the following resolvers:

resolvers += "twitter-repo" at "http://maven.twttr.com"

Using phantom-sbt to test requires custom resolvers

In your plugins.sbt, you will also need this if you plan to use phantom-sbt:

def outworkersPattern = {
  val pList = Resolver.mavenStyleBasePattern) :: Nil
  Patterns(pList, pList, true)
}

resolvers ++= Seq(
  Resolver.url("Maven Ivy Outworkers", url(Resolver.DefaultMavenRepositoryRoot))(outworkersPattern)
)

addSbtPlugin("com.outworkers" %% "phantom-sbt" % phantomVersion)

Using phantom with the Spray framework

Spray users will probably be affected by a conflict in shapeless versions. To fix the conflict, add the following dependency to your build, which will allow you to use phantom and Spray together without any issues.

libraryDependencies ++= Seq(
  "io.spray" %% "spray-routing-shapeless2" % SprayVersion
)