I want to retrieve old build number, version number and some other variables from build of some maven project. That build happened 2-3 days before. I tried following groovy script to retrieve variables.
import hudson.model.*
for(item in Hudson.instance.items)
{
prop = item.getAllJobs()
for(param in prop)
{
build = param.getLastSuccessfulBuild()
println(build)
println("------------------------------------------")
variabls = build.getBuildVariables()
for(vb in variabls)
{
println (vb)
}
println("------------------------------------------")
env = build.getWorkspace()
for(ev in env)
{
println (ev)
}
}
}
I was successful in retrieving build number, but I also want version number for project for which build was done. I also tried APIs on Build from jenkins JAVADOC, but somehow failed to get answer. Is their any way to get that?
I might think of getting this version number by reading POM from workspace of previous build, but all want to know is their any other way by which I can get that version number of maven build.
Thanks