Skip to main content

Dependencies

Dependencies are declared in a simple string format and automatically converted to sbt's libraryDependencies.

Format

Dependencies use the format "organization:artifact:version":

dependencies = [
"org.typelevel:cats-core:2.13.0",
"io.circe:circe-core:0.14.10"
]

This is equivalent to the following sbt syntax:

libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.13.0",
"io.circe" %% "circe-core" % "0.14.10"
)

Dependency Types

By default, all dependencies use Scala cross-versioning (%%). To declare Java dependencies, use the nested object format:

dependencies {
scala = ["org.typelevel:cats-core:2.13.0"]
java = ["com.google.code.gson:gson:2.11.0"]
}

All keys are optional — include only the ones you need.

Key Mapping

Keysbt OperatorDescription
scala%%Standard Scala cross-versioned library
java%Plain Java library (no cross-version)

Flat vs Nested

The flat list format is equivalent to { scala = [...] }:

# These two are equivalent:
dependencies = ["org.typelevel:cats-core:2.13.0"]

dependencies {
scala = ["org.typelevel:cats-core:2.13.0"]
}

You can mix formats between dependencies and testDependencies:

# Nested dependencies with Java libs
dependencies {
scala = ["org.typelevel:cats-core:2.13.0"]
java = ["com.google.code.gson:gson:2.11.0"]
}

# Flat testDependencies (all Scala)
testDependencies = [
"org.scalatest:scalatest:3.2.19"
]

Test Dependencies

Test dependencies are declared separately and automatically get the Test scope:

testDependencies = [
"org.scalatest:scalatest:3.2.19",
"org.scalatestplus:scalacheck-1-18:3.2.19.0"
]

This is equivalent to:

libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"org.scalatestplus" %% "scalacheck-1-18" % "3.2.19.0" % Test
)

Test dependencies also support the nested object format:

testDependencies {
scala = ["org.scalatest:scalatest:3.2.19"]
java = ["junit:junit:4.13.2"]
}