blob: a2f5f390e2afc5300600c3d29596ef7ce6d3e214 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*
package cbt
object Coursier{
implicit class CoursierDependencyResolution(d: MavenDependency){
import d._
def resolveCoursier = {
import coursier._
val repositories = Seq(
Cache.ivy2Local,
MavenRepository("https://repo1.maven.org/maven2")
)
val start = Resolution(
Set(
MavenDependency(
Module(groupId, artifactId), version
)
)
)
val fetch = Fetch.from(repositories, Cache.fetch())
val resolution = start.process.run(fetch).run
val errors: Seq[(MavenDependency, Seq[String])] = resolution.errors
if(errors.nonEmpty) throw new Exception(errors.toString)
import java.io.File
import scalaz.\/
import scalaz.concurrent.Task
val localArtifacts: Seq[FileError \/ File] = Task.gatherUnordered(
resolution.artifacts.map(Cache.file(_).run)
).run
val files = localArtifacts.map(_.toEither match {
case Left(error) => throw new Exception(error.toString)
case Right(file) => file
})
resolution.dependencies.map( d => cbt.MavenDependency(d.module.organization,d.module.name, d.version)).to[collection.immutable.Seq]
}
}
}
*/
|