Created
January 19, 2018 19:55
-
-
Save nwtgck/ccc0d481aa6fc9cd1eac50a723bd0e5e 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
// How to run | |
// cd <root which has pom.xml> | |
// scala PomToSbt.scala | |
// Then, you have output | |
object PomToSbt extends App{ | |
// (from: https://stackoverflow.com/a/15430347/2885946) | |
import scala.xml._ | |
val dependencies = ((XML.load("pom.xml") \\ "dependencies") \ "dependency").map((dependency: Node) => { | |
val groupId = (dependency \ "groupId").text | |
val artifactId = (dependency \ "artifactId").text | |
val version = (dependency \ "version").text | |
val scope = (dependency \ "scope").text | |
val classifier = (dependency \ "classifier").text | |
val artifactValName: String = artifactId.replaceAll("[-\\.]", "_") | |
s"${groupId} % ${artifactId} % ${version}" | |
}) | |
println(dependencies.mkString(",\n")) | |
} |
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
// How to run | |
// cd <root which has pom.xml> | |
// scala PomToSbt.scala | |
// Then, you have output | |
object PomToSbt extends App{ | |
// (from: https://stackoverflow.com/a/15430347/2885946) | |
import scala.xml._ | |
val dependencies = ((XML.load("pom.xml") \\ "dependencies") \ "dependency").map((dependency: Node) => { | |
val groupId = (dependency \ "groupId").text | |
val artifactId = (dependency \ "artifactId").text | |
val version = (dependency \ "version").text | |
val scope = (dependency \ "scope").text | |
val classifier = (dependency \ "classifier").text | |
val artifactValName: String = artifactId.replaceAll("[-\\.]", "_") | |
s"${groupId} % ${artifactId} % ${version}" | |
}) | |
println(dependencies.mkString(",\n")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment