Created
May 5, 2010 12:59
-
-
Save kyleburton/390732 to your computer and use it in GitHub Desktop.
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
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