sbt/notes/0.1.0-M1.markdown

42 lines
1.5 KiB
Markdown
Raw Normal View History

2015-06-28 18:08:52 +02:00
[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
```scala
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]
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.