Since Jenkins 1.460, calling getMavenArtifacts()
on an instance of MavenBuild
is returning null, whereas previously that would work fine.
Have there been breaking changes in the Jenkins API, or is this a Jenkins bug?
The code I'm executing is a post-build System Groovy script, that exposes the Maven version of a build as an environment variable for subsequent steps in the Jenkins build process to use:
import hudson.model.*;
import hudson.util.*;
def thr = Thread.currentThread();
def currentBuild = thr?.executable;
def mavenVer = currentBuild.getMavenArtifacts().getModuleRecords()[0].mainArtifact.version;
def newParamAction = new hudson.model.ParametersAction(new hudson.model.StringParameterValue("MAVEN_VERSION", mavenVer));
currentBuild.addAction(newParamAction);