mirror of https://github.com/sbt/sbt.git
43 lines
1.6 KiB
Markdown
43 lines
1.6 KiB
Markdown
[coursier](https://github.com/alexarchambault/coursier/) is a pure Scala
|
|
substitute for [Aether](http://www.eclipse.org/aether/). Given a set
|
|
of dependencies, and Maven repositories, it can list all their transitive
|
|
dependencies, solving possible version conflicts.
|
|
|
|
This is the first release of coursier.
|
|
|
|
Test it in your browser with its [Scala JS demo](https://alexarchambault.github.io/coursier/#demo).
|
|
|
|
### Overview
|
|
|
|
Use it like:
|
|
|
|
val repositories = Seq(
|
|
Repository.ivy2Local,
|
|
Repository.mavenCentral
|
|
)
|
|
|
|
val dependencies = Set(
|
|
Dependency(Module("com.github.alexarchambault", "argonaut-shapeless_6.1_2.11"), "0.2.0"),
|
|
Dependency(Module("com.github.alexarchambault", "shapeless-refined-std_2.11"), "0.1.1")
|
|
)
|
|
|
|
val resolution =
|
|
Resolution(dependencies) // Initial resolution state
|
|
.process // Resolution process (scalaz-stream like)
|
|
.run(repositories) // Run the resolution with these repositories
|
|
.run // Run the resulting Task[Resolution]
|
|
|
|
// Let's inspect the results
|
|
|
|
val allDependencies = resolution.minDependencies // Set[Dependency]
|
|
val allArtifacts = resolution.artifacts // Seq[Artifact]
|
|
|
|
val errors = resolution.errors // Metadata errors (not found, malformed, ...)
|
|
val conflicts = resolution.conflicts // Version conflicts
|
|
|
|
// URLs of the artifacts (JARs)
|
|
val allArtifactsUrls = allArtifacts.map(_.url) // Seq[String]
|
|
|
|
Both metadata and artifacts can be cached. Resolution per se only fetches
|
|
metadata, and gives you back artifact URLs.
|