jenkins - 如何在 Jenkins 管道中运行远程库函数时修复“java.io.NotSerializableException”
问题描述
我正在设置一个 Jenkins 管道,它调用一个外部库,其中包含一个使用 xmlunit 的 Groovy 编写的比较 XML 函数。
该函数如下所示:
import java.util.List
import org.custommonkey.xmlunit.*
// Gives you a list of all the differences.
@NonCPS
void call(String xmlControl, String xmlTest) throws Exception {
String myControlXML = xmlControl
String myTestXML = xmlTest
DetailedDiff myDiff = new DetailedDiff(compareXML(myControlXML,
myTestXML));
List allDifferences = myDiff.getAllDifferences();
assertEquals(myDiff.toString(), 0, allDifferences.size());
}
但是,在 Jenkins 中运行管道时,它会返回一个java.io.NotSerializableException
.
检查 StackOverflow 似乎添加@NonCPS
注释可能会有所帮助。
但遗憾的是,这并没有什么不同。
我还能尝试解决java.io.NotSerializableException
什么?
解决方案
推荐阅读
- android - 片段 Anjlab 中的 onActivityResult()
- r - 删除带有编号的列的最后一个元素
- c# - OnMouseUp 没有响应
- c# - C#,写入.txt文件,不删除上一行
- timestamp - Google App Maker - 在 onclick 方法中添加时间戳收集按钮
- java - Spring 等效于 Guice 的 requireBinding
- azure-devops - 如何将现有工作项添加到板?
- node.js - 如何从生产 nodejs 服务器进行身份验证以获取 google 电子表格 API 的令牌
- r - 我正在尝试将“.0”添加到向量中的任何单个数字上
- c++ - C++ 在命名空间中找不到函数