mirror of https://github.com/sbt/sbt.git
Merge pull request #152 from alexarchambault/topic/update-readme
Update readme
This commit is contained in:
commit
751ff51032
21
README.md
21
README.md
|
|
@ -30,7 +30,7 @@ and is able to fetch metadata and artifacts from both Maven and Ivy repositories
|
||||||
|
|
||||||
Compared to the default dependency resolution of SBT, it adds:
|
Compared to the default dependency resolution of SBT, it adds:
|
||||||
* downloading of artifacts in parallel,
|
* downloading of artifacts in parallel,
|
||||||
* better offline mode - one can safely work with snapshot dependencies if these are in cache (SBT tends to try to fail if it cannot check for updates),
|
* better offline mode - one can safely work with snapshot dependencies if these are in cache (SBT tends to try and fail if it cannot check for updates),
|
||||||
* non obfuscated cache (cache structure just mimicks the URL it caches),
|
* non obfuscated cache (cache structure just mimicks the URL it caches),
|
||||||
* no global lock (no "Waiting for ~/.ivy2/.sbt.ivy.lock to be available").
|
* no global lock (no "Waiting for ~/.ivy2/.sbt.ivy.lock to be available").
|
||||||
|
|
||||||
|
|
@ -108,6 +108,12 @@ Add an import for coursier,
|
||||||
import coursier._
|
import coursier._
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To resolve dependencies, first create a `Resolution` case class with your dependencies in it,
|
To resolve dependencies, first create a `Resolution` case class with your dependencies in it,
|
||||||
```scala
|
```scala
|
||||||
val start = Resolution(
|
val start = Resolution(
|
||||||
|
|
@ -368,6 +374,10 @@ In the code below, we'll assume some imports are around,
|
||||||
import coursier._
|
import coursier._
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Resolving dependencies involves create an initial resolution state, with all the initial dependencies in it, like
|
Resolving dependencies involves create an initial resolution state, with all the initial dependencies in it, like
|
||||||
```scala
|
```scala
|
||||||
val start = Resolution(
|
val start = Resolution(
|
||||||
|
|
@ -400,7 +410,7 @@ scala> val repositories = Seq(
|
||||||
| Cache.ivy2Local,
|
| Cache.ivy2Local,
|
||||||
| MavenRepository("https://repo1.maven.org/maven2")
|
| MavenRepository("https://repo1.maven.org/maven2")
|
||||||
| )
|
| )
|
||||||
repositories: Seq[coursier.core.Repository] = List(IvyRepository(file:/Users/alexandre/.ivy2/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext],None,None,Map(),true,true,true,true), MavenRepository(https://repo1.maven.org/maven2,None,false))
|
repositories: Seq[coursier.core.Repository] = List(IvyRepository(file://${user.home}/.ivy2/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext],None,None,Map(),true,true,true,true), MavenRepository(https://repo1.maven.org/maven2,None,false))
|
||||||
```
|
```
|
||||||
The first one, `Cache.ivy2Local`, is defined in `coursier.Cache`, itself from the `coursier-cache` module that
|
The first one, `Cache.ivy2Local`, is defined in `coursier.Cache`, itself from the `coursier-cache` module that
|
||||||
we added above. As we can see, it is an `IvyRepository`, picking things under `~/.ivy2/local`. An `IvyRepository`
|
we added above. As we can see, it is an `IvyRepository`, picking things under `~/.ivy2/local`. An `IvyRepository`
|
||||||
|
|
@ -615,8 +625,11 @@ on the [Gitter channel](https://gitter.im/alexarchambault/coursier).
|
||||||
|
|
||||||
- [Lars Hupel](https://github.com/larsrh/)'s [libisabelle](https://github.com/larsrh/libisabelle) fetches
|
- [Lars Hupel](https://github.com/larsrh/)'s [libisabelle](https://github.com/larsrh/libisabelle) fetches
|
||||||
some of its requirements via coursier,
|
some of its requirements via coursier,
|
||||||
- [jupyter-scala](https://github.com/alexarchambault/jupyter-scala) should soon allow
|
- [jupyter-scala](https://github.com/alexarchambault/jupyter-scala) is launched
|
||||||
to add dependencies in its sessions with coursier (initial motivation for writing coursier),
|
and allows to add dependencies in its sessions with coursier (initial motivation
|
||||||
|
for writing coursier),
|
||||||
|
- [Apache Toree](https://github.com/apache/incubator-toree) - formerly known as [spark-kernel](https://github.com/ibm-et/spark-kernel), is now using coursier to
|
||||||
|
add dependencies on-the-fly ([#4](https://github.com/apache/incubator-toree/pull/4)),
|
||||||
- Your project here :-)
|
- Your project here :-)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ and is able to fetch metadata and artifacts from both Maven and Ivy repositories
|
||||||
|
|
||||||
Compared to the default dependency resolution of SBT, it adds:
|
Compared to the default dependency resolution of SBT, it adds:
|
||||||
* downloading of artifacts in parallel,
|
* downloading of artifacts in parallel,
|
||||||
* better offline mode - one can safely work with snapshot dependencies if these are in cache (SBT tends to try to fail if it cannot check for updates),
|
* better offline mode - one can safely work with snapshot dependencies if these are in cache (SBT tends to try and fail if it cannot check for updates),
|
||||||
* non obfuscated cache (cache structure just mimicks the URL it caches),
|
* non obfuscated cache (cache structure just mimicks the URL it caches),
|
||||||
* no global lock (no "Waiting for ~/.ivy2/.sbt.ivy.lock to be available").
|
* no global lock (no "Waiting for ~/.ivy2/.sbt.ivy.lock to be available").
|
||||||
|
|
||||||
|
|
@ -104,10 +104,38 @@ libraryDependencies ++= Seq(
|
||||||
```
|
```
|
||||||
|
|
||||||
Add an import for coursier,
|
Add an import for coursier,
|
||||||
```tut:silent
|
```scala
|
||||||
import coursier._
|
import coursier._
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```tut:invisible
|
||||||
|
import coursier.{ Cache => _, _ }
|
||||||
|
```
|
||||||
|
|
||||||
|
```tut:invisible
|
||||||
|
object Cache {
|
||||||
|
val ivy2LocalIsIvy = coursier.Cache.ivy2Local match {
|
||||||
|
case _: coursier.ivy.IvyRepository => true
|
||||||
|
case _ => false
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(ivy2LocalIsIvy)
|
||||||
|
|
||||||
|
// The goal of this is to make the printed ivy2Local below more anonymous,
|
||||||
|
// with literally ${user.home} in it rather than the current home dir.
|
||||||
|
// ${user.home} could have been used in the definition of ivy2Local itself,
|
||||||
|
// but it would then have required properties, which would have cluttered
|
||||||
|
// output here.
|
||||||
|
|
||||||
|
val ivy2Local = coursier.Cache.ivy2Local.copy(
|
||||||
|
pattern = coursier.Cache.ivy2Local.pattern.replace("file:" + sys.props("user.home"), "file://${user.home}")
|
||||||
|
)
|
||||||
|
|
||||||
|
def fetch() = coursier.Cache.fetch()
|
||||||
|
def file(artifact: Artifact) = coursier.Cache.file(artifact)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
To resolve dependencies, first create a `Resolution` case class with your dependencies in it,
|
To resolve dependencies, first create a `Resolution` case class with your dependencies in it,
|
||||||
```tut:silent
|
```tut:silent
|
||||||
val start = Resolution(
|
val start = Resolution(
|
||||||
|
|
@ -366,10 +394,15 @@ these input metadata. It uses `scalaz.concurrent.Task` as a `Monad` to wrap them
|
||||||
It caches all of these (metadata and artifacts) on disk, and validates checksums too.
|
It caches all of these (metadata and artifacts) on disk, and validates checksums too.
|
||||||
|
|
||||||
In the code below, we'll assume some imports are around,
|
In the code below, we'll assume some imports are around,
|
||||||
```tut:silent
|
```scala
|
||||||
import coursier._
|
import coursier._
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```tut:invisible
|
||||||
|
import coursier.{ Cache => _, _ }
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Resolving dependencies involves create an initial resolution state, with all the initial dependencies in it, like
|
Resolving dependencies involves create an initial resolution state, with all the initial dependencies in it, like
|
||||||
```tut:silent
|
```tut:silent
|
||||||
val start = Resolution(
|
val start = Resolution(
|
||||||
|
|
@ -616,8 +649,11 @@ on the [Gitter channel](https://gitter.im/alexarchambault/coursier).
|
||||||
|
|
||||||
- [Lars Hupel](https://github.com/larsrh/)'s [libisabelle](https://github.com/larsrh/libisabelle) fetches
|
- [Lars Hupel](https://github.com/larsrh/)'s [libisabelle](https://github.com/larsrh/libisabelle) fetches
|
||||||
some of its requirements via coursier,
|
some of its requirements via coursier,
|
||||||
- [jupyter-scala](https://github.com/alexarchambault/jupyter-scala) should soon allow
|
- [jupyter-scala](https://github.com/alexarchambault/jupyter-scala) is launched
|
||||||
to add dependencies in its sessions with coursier (initial motivation for writing coursier),
|
and allows to add dependencies in its sessions with coursier (initial motivation
|
||||||
|
for writing coursier),
|
||||||
|
- [Apache Toree](https://github.com/apache/incubator-toree) - formerly known as [spark-kernel](https://github.com/ibm-et/spark-kernel), is now using coursier to
|
||||||
|
add dependencies on-the-fly ([#4](https://github.com/apache/incubator-toree/pull/4)),
|
||||||
- Your project here :-)
|
- Your project here :-)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue