只是看看https://github.com/jenkinsci/pipeline-plugin/blob/master/DEVGUIDE.md。
我最初有这个:
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
// The Jenkins job's workspace
FilePath path = new FilePath(build.getWorkspace(), "bpsSpec.yml");
// ...
}
阅读升级指南后,我将其更改为
public boolean perform(Run<?,?> build, Launcher launcher, TaskListener listener) {
FilePath workspace = null;
// The Jenkins job's workspace
if (build instanceof AbstractBuild) {
workspace = build.getWorkspace();
}
FilePath path = new FilePath(workspace, "bpsSpec.yml");
// ..
}
文档说Use the specified workspace rather than the former build.getWorkspace()
...但我不知道是谁指定了这个以及如何指定。另外build.getWorkspace()
导致编译错误,可能是因为我之前从未使用过 generics 并且遗漏了一些明显的错误。