【问题标题】:Jenkins NextGeneration Warnings plugin: publishIssues fails with there's no @DataBoundConstructorJenkins NextGeneration 警告插件:publishIssues 失败,没有 @DataBoundConstructor
【发布时间】:2019-03-20 09:45:10
【问题描述】:

您好,我正在使用 Jenkins 管道文件,我想集成 cpd 工具。 因此,我正在使用 NextGenerationWarnings 插件并遵循他们的docs(请参阅高级管道配置部分)。

出于测试目的,我将调用添加到结帐阶段。

阶段:

stage ("Checkout") {
            cleanWs()
            echo "Using branch $BRANCH_NAME"
            def gitResult = checkout(scm)
            echo "${gitResult}"
            def myworkspace = pwd()
            sh "/var/lib/jenkins/pmd-bin-6.12.0/bin/run.sh cpd -failOnViolation false --minimum-tokens 70 --files $myworkspace/PROG --language cpp --format xml > cpd.xml"
            def cpd = scanForIssues tool: cpd(pattern: 'cpd.xml')
            unzip publishIssues {issues: [cpd]}
        }

错误:

在构建期间,我收到以下错误消息。

[管道] 发布问题

[管道] }

[管道] // 阶段

[管道]回显

错误:java.lang.IllegalArgumentException:无法实例化 {issues=org.jenkinsci.plugins.workflow.cps.CpsClosure2@2c319167} 发布问题步骤(问题: org.kohsuke.stapler.NoStaplerConstructorException:没有 @DataBoundConstructor 在类的任何构造函数上 io.jenkins.plugins.analysis.core.steps.AnnotatedReport[], failedNewAll?(deprecated): int, failedNewHigh?(deprecated): int, failedNewLow?(deprecated): int, failedNewNormal?(deprecated): int, failedTotalAll?(deprecated): int, failedTotalHigh?(deprecated): int, failedTotalLow?(deprecated): int, failedTotalNormal?(deprecated): int, 健康?:int,id?:字符串,ignoreFailedBuilds?:布尔值, ignoreQualityGate?: boolean, minimumSeverity?: String, name?: String, qualityGates?: QualityGate(threshold: int, type: QualityGateType[TOTAL, TOTAL_ERROR, TOTAL_HIGH, TOTAL_NORMAL, TOTAL_LOW、NEW、NEW_ERROR、NEW_HIGH、NEW_NORMAL、NEW_LOW、DELTA、 DELTA_ERROR、DELTA_HIGH、DELTA_NORMAL、DELTA_LOW],不稳定: boolean)[], referenceJobName?: String, sourceCodeEncoding?: String, 不健康?:int,unstableNewAll?(已弃用):int, 不稳定新高?(不推荐):int,不稳定新低?(不推荐):整数, 不稳定新常态?(不推荐使用):int,不稳定TotalAll?(不推荐使用): int,unstableTotalHigh?(已弃用):int, 不稳定总低?(不推荐):int,不稳定总正常?(不推荐): int): java.lang.ClassCastException: io.jenkins.plugins.analysis.core.steps.PublishIssuesStep.issues 期望 java.util.List 但收到了类 org.jenkinsci.plugins.workflow.cps.CpsClosure2

我不确定 @DataBoundConstructor 注释的作用,但这可能与过时的 Java 版本有关吗?

【问题讨论】:

    标签: java jenkins groovy jenkins-pipeline


    【解决方案1】:

    我发现了我的问题。

    我不知道为什么,但出于某种原因,我在publishIssues issues: [cpd] 周围添加了unzip 和这些{}

    删除它们,解决了我的问题,现在它完美无缺。

    【讨论】:

      猜你喜欢
      • 2013-09-28
      • 2011-01-29
      • 1970-01-01
      • 1970-01-01
      • 2018-02-28
      • 2016-10-30
      • 1970-01-01
      • 2017-02-06
      • 2016-06-16
      相关资源
      最近更新 更多