由於Jenkins 1.460,在MavenBuild
的實例上調用getMavenArtifacts()
正在返回null,而之前的工作正常。Jenkins - MavenBuild.getMavenArtifacts()返回NULL
Jenkins API中是否發生過突變,或者這是一個Jenkins錯誤?
我執行的代碼生成後,系統Groovy腳本,暴露構建的Maven的版本,如在詹金斯後續步驟的環境變量構建過程中使用:
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);
肯定有過[更改Maven插件(https://github.com/jenkinsci/jenkins/commits/jenkins-1.460/maven - 插件)爲1.460。如果將Jenkins滾回到以前的版本不是一種選擇,請考慮將插件固定到以前的版本。 – 2012-04-18 08:13:30