groovy.lang.MissingPropertyException:无此类属性:类:WorkflowScript的cobertura

问题描述

有人可以帮助解决以下错误。我想在詹金斯中使用声明性管道生成cobertura报告。

我在build.gradle文件添加了以下几行

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "net.saliman:gradle-cobertura-plugin:2.2.7"
  }
}

apply plugin: "net.saliman.cobertura"

And this is my post function

post {
        always {
         junit(
        allowEmptyResults: true,testResults: '**/test-reports/*.xml'
      )
      step([$class:cobertura,autoUpdateHealth: false,autoUpdateStability: false,coberturaReportFile: '**/build/reports/cobertura/coverage.xml',conditionalCoverageTargets: '20,0',failUnhealthy: false,failUnstable: false,lineCoverageTargets: '20,maxnumberOfBuilds: 0,methodCoverageTargets: '20,onlyStable: false,sourceEncoding: 'ASCII',zoomCoverageChart: false])
    }
        }

执行始终发布条件时出错:

 groovy.lang.MissingPropertyException: No such property: cobertura for class: WorkflowScript
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)