Groovy web console

subscribe to the feed Subscribe
to this
site
extractPOMVersion (via #groovywebconsole)
tweet this snippet Tweet
this
script

extractPOMVersion

Published 1 week ago by Naval Gupta with tags extractPOM extractVersion pipelineScript
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
String pom_version = '<version>01.11.00-SNAPSHOT</version>'
def matcher = pom_version =~ '<version>(\\d*)\\.(\\d*)\\.(\\d*)(-SNAPSHOT)*</version>'
println "POM Version: " + matcher[0]

String project_name = '<name>test-services</name>'
matcher = project_name =~ '<name>(.+)</name>'
println "Project name: " + matcher[0][1]