我在 Jenkins 上运行构建时遇到异常,我的构建失败的场景是我项目的集成测试部分。但是,我所有的 junit 和 Cucumber 测试用例在我的本地机器上都运行良好。
我在 Jenkins 服务器上收到的异常。
field - $jacocoData Exception is - java.beans.IntrospectionException: Method not found: is$jacocoData
最佳答案
可以看到issue: https://github.com/jacoco/jacoco/issues/168
To collect execution data JaCoCo instruments the classes under test which adds two members to the classes: A private static field $jacocoData and a private static method $jacocoInit(). Both members are marked as synthetic. Please change your code to ignore synthetic members. This is a good practice anyways as also the Java compiler creates synthetic members in certain situation.
例如引用下面的代码:
for (Field field : fields) {
if (!field.isSynthetic()) {
// enter code here
}
}
关于java - 运行 Jenkins 构建时获取异常字段 - $jacocoData 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42413735/