Skip to content

Instantly share code, notes, and snippets.

@pfn
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfn/52661a0744529eda27ac to your computer and use it in GitHub Desktop.
Save pfn/52661a0744529eda27ac to your computer and use it in GitHub Desktop.
alternative to externalPom()
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