Skip to content

Instantly share code, notes, and snippets.

@MaxNevermind
Forked from mslinn/PomToSbt.scala
Last active June 29, 2018 11:43
Show Gist options
  • Save MaxNevermind/377d93796f2e441652db5ccce4617144 to your computer and use it in GitHub Desktop.
Save MaxNevermind/377d93796f2e441652db5ccce4617144 to your computer and use it in GitHub Desktop.
Convert pom.xml to build.sbt
val lines = (scala.xml.XML.load("pom.xml") \\ "dependencies") \ "dependency" map { dependency =>
val groupId = (dependency \ "groupId").text
val artifactId = (dependency \ "artifactId").text
val version = (dependency \ "version").text
val scope = (dependency \ "scope").text match {
case "" => ""
case x => s""" % "$x""""
}
s"""libraryDependencies += "$groupId" % "$artifactId" % "$version"$scope"""
}
lines foreach println
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment