这是我在项目中执行mvn release:prepare release:perform时看到的输出的一小部分:
[INFO]
[INFO] --- access-modifier-checker:1.8:enforce (default-enforce) @ scm-httpclient ---
[ERROR] com/meowlomo/jenkins/scm_httpclient/ScmHttpClient:84 hudson/model/AbstractBuild.getChangeSets()Ljava/util/List; must not be used
[ERROR] com/meowlomo/jenkins/scm_httpclient/ScmHttpClient:89 hudson/model/AbstractBuild.getChangeSets()Ljava/util/List; must not be used
[ERROR] com/meowlomo/jenkins/scm_httpclient/ScmHttpClient:94 hudson/model/AbstractBuild.getChangeSets()Ljava/util/List; must not be used
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
这些错误表明我不能使用build.getChangeSets()此方法。为什么?
我的代码是:
@Override
public void perform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener)
throws IOException, InterruptedException {
AbstractBuild<?, ?> build = (AbstractBuild<?, ?>) run;
if (!build.getChangeSets().isEmpty()) {
logger.println("the scm has changed...");
CommitInfo commitInfo = new CommitInfo();
if (saveAffectedPath) {
commitInfo.doSaveAffectedPathsWork(regexString, addScmPath, build.getChangeSets(), logger, variables);
}
JobBuildMessage jobBuildMessage = new JobBuildMessage();
if (saveJobBuildMessage) {
jobBuildMessage.doSaveJobBuildMessageWork(envVars, commitInfo.getCommitInfos(build.getChangeSets()),
variables);
}
}
}
是否有解决此问题的建议?
谢谢!