Manage Dependencies

SBT builds are Scala projects. This means you can write arbitrary Scala code to structure your build. The project dependencies are one aspect of the build that change rather frequently. Keeping your dependencies in a single scala file makes it easier to maintain and review changes.

Dependencies.scala

The Dependencies.scala must be placed in the projectfolder.

/project
   Dependencies.scala
build.sbt

Example

Dependencies.scala

object Dependencies {
   // single dependency
   val cats: ModuleID = "org.typelevel" %% "cats-core" % "0.9.0"

   // multiple dependencies
   val akkaHttpVersion = "10.0.10"     
   val akkaHttp: List[ModuleID] = List(
      "com.typesafe.akka" %% "akka-http",
      "com.typesafe.akka" %% "akka-http2-support"
   ).map(_ % akkaHttpVersion)
}

build.sbt

libraryDependencies += Dependencies.cats
libraryDependencies ++= Dependencies.akkaHttp

results matching ""

    No results matching ""