Skip to content

Instantly share code, notes, and snippets.

@jgeorgeson
Created July 1, 2016 20:26
Show Gist options
  • Save jgeorgeson/29a1304af74f4716c2bf804c4f5cc7ca to your computer and use it in GitHub Desktop.
Save jgeorgeson/29a1304af74f4716c2bf804c4f5cc7ca to your computer and use it in GitHub Desktop.
Read properties from Maven pom.xml with Groover
def inputFile = new File("pom.xml")
if(!inputFile.exists()) {
println "Could not find 'pom.xml' file."
} else {
def project = new XmlSlurper(false,true)
.parseText(inputFile.text)
.declareNamespace('':'http://maven.apache.org/POM/4.0.0')
def p2path = project.properties.'p2.repoPath'.text()
def p2ver = project.properties.'p2.repoVersion'.text()
println "P2 Repo Path '" + p2path + "'"
println "P2 Repo Version '" + p2ver + "'"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment