Last active
November 18, 2016 15:48
-
-
Save spacelis/d16addf06f84f4e9a392e0605d117ffe to your computer and use it in GitHub Desktop.
Retrieve local jar cache by ModuleID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val localJars = TaskKey[Seq[File]]("Collect jars in local Ivy cache") | |
lazy val devDeploySettings = Seq( | |
deployTask := { | |
val remote = "path/to/a/folder" | |
for (f <- neo4jDeployJars.value) | |
{ | |
println(s"Copy $f -> $remote") | |
Seq("cp", f.getAbsolutePath, remote) ! | |
} | |
}, | |
localJars := { | |
val is = (ivyScala in Compile).value | |
def mkModuleRef(m: ModuleID) = s"${m.organization}:${(for(cvf <- CrossVersion(m, is)) yield cvf(m.name)) getOrElse m.name}:${m.revision}" | |
// Only jars for compile scope will be searched | |
val libMap = (for (p <- (fullClasspath in Compile).value; | |
m <- p.metadata.get(moduleID.key)) | |
yield mkModuleRef(m) -> p.data).toMap | |
// Find jars listed in libraryDependencies | |
for (m <- libraryDependencies.value; | |
verM = mkModuleRef(m) | |
if libMap contains verM) | |
yield libMap(verM) | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment