Last active
August 29, 2015 14:10
-
-
Save pfn/52661a0744529eda27ac to your computer and use it in GitHub Desktop.
alternative to externalPom()
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
def loadFromPom(pom: File): Seq[ModuleID] = { | |
import scala.xml._ | |
val root = XML.loadFile(pom) | |
val parent = root \\ "parent" // TODO look up variables in parents | |
(root \\ "dependency") map { n => | |
for { | |
o <- n.child.find(_.label == "groupId") | |
a <- n.child.find(_.label == "artifactId") | |
v <- n.child.find(_.label == "version") | |
} yield ModuleID(o.text, a.text, v.text, | |
n.child.find(_.label == "scope") map (_.text)) | |
} collect { case Some(x) => x } | |
} | |
libraryDependencies ++= loadFromPom(baseDirectory.value / "pom.xml") filterNot ( | |
_.organization == "com.google.android") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment