Dependency¶
Syntax¶
Version¶
Besides plain versions, like 1.0.2, the version field accepts
- version intervals, like
[1.0,2.0)or2.0+, latest.release,latest.integration, andlatest.stable, that pick the latest version from the listing of the module in the repository,- the Maven 2 meta versions
RELEASEandLATEST, handled likelatest.releaseandlatest.integrationrespectively.
Bill Of Material¶
One can pass a Bill-Of-Material, or BOM, via dependencies, like
Note the use of % rather than : to separate the components of the BOM coordinates.
Fetching artifacts without POM files¶
Some artifacts do not have a POM or Ivy file in the repository. Coursier supports fetching
such artifacts directly via the url= parameter:
Note that the URL must be URL-encoded. The url parameter instructs coursier to fetch the
artifact from the given URL directly, bypassing the usual POM resolution. For example, to
fetch a JAR at https://example.com/my-lib/1.0/my-lib-1.0.jar:
Gradle Module Variant¶
One can add Gradle Module attributes to a dependency, so that it checks if a Gradle Module file exists for that dependency, and uses it to pick a "variant" of that dependency:
org.jetbrains.kotlinx:kotlinx-html-js:0.11.0,variant.org.gradle.usage=kotlin-runtime,variant.org.jetbrains.kotlin.platform.type=js,variant.org.jetbrains.kotlin.js.compiler=ir,variant.org.gradle.category=library
If we split / indent that dependency for readability, we get
org.jetbrains.kotlinx:kotlinx-html-js:0.11.0,
variant.org.gradle.usage=kotlin-runtime,
variant.org.jetbrains.kotlin.platform.type=js,
variant.org.jetbrains.kotlin.js.compiler=ir,
variant.org.gradle.category=library
Gradle Module attributes are key-value pairs. These are added as parameters to dependencies.
variant. is added as prefix to the key of the attribute, and the parameter value is the attribute
value.