Skip to content

Instantly share code, notes, and snippets.

@kyleburton
Created May 5, 2010 12:59
Show Gist options
  • Save kyleburton/390732 to your computer and use it in GitHub Desktop.
Save kyleburton/390732 to your computer and use it in GitHub Desktop.
import scala.io.Source
import scala.xml._
object SbtDepsFromPom {
def main ( args: Seq[String] ) {
val pomContents = Source.fromFile(args(0)).mkString
var xml = XML.loadString(pomContents)
var deps = (xml \\ "dependency") map { (dep) =>
List( (dep \\ "groupId")(0).text,
(dep \\ "artifactId")(0).text,
(dep \\ "version")(0).text,
(dep \\ "scope")(0).text)
}
deps.foreach {(dep) =>
dep.map { "\"%s\"".format(_) } match {
case List(group, artifact, version, scope) => {
println("%-28s %% %-18s %% %-12s %% %s".format(group,artifact,version,scope))
}
}
}
}
}
SbtDepsFromPom.main(argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment