Jenkins 黄瓜在管道作业中不工作

Jenkins 黄瓜在管道作业中不工作,jenkins,dsl,cucumber-jvm,Jenkins,Dsl,Cucumber Jvm,我正在使用Jenkins Pipeline作业构建和运行单元测试,所有阶段都是用groovy脚本编写的,在生成cucumber报告时出现以下异常: [CucumberReport] Preparing Cucumber Reports [CucumberReport] Copied 0 json files from workspace "/var/opt/jenkins/data/workspace/myJenkinsJob/${pwd()}/target/cucumber-html-repo

我正在使用Jenkins Pipeline作业构建和运行单元测试,所有阶段都是用groovy脚本编写的,在生成cucumber报告时出现以下异常:

[CucumberReport] Preparing Cucumber Reports
[CucumberReport] Copied 0 json files from workspace "/var/opt/jenkins/data/workspace/myJenkinsJob/${pwd()}/target/cucumber-html-report" to reports directory "/var/opt/jenkins/data/jobs/myJenkinsJob/builds/13/cucumber-html-reports/.cache"


java.lang.IllegalStateException: basedir /myJenkinsJOb/builds/13/cucumber-html-reports/.cache does not exist


    at org.apache.tools.ant.DirectoryScanner.scan(DirectoryScanner.java:879)
    at net.masterthought.jenkins.CucumberReportPublisher.findJsonFiles(CucumberReportPublisher.java:191)
    at net.masterthought.jenkins.CucumberReportPublisher.generateReport(CucumberReportPublisher.java:139)
    at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:108)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:59)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:52)
    at hudson.security.ACL.impersonate(ACL.java:213)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
请在下面找到我的DSL脚本:

stage "Publish Reports"
echo "***** Publish Reports *****"
def ReportPath = "${pwd()}/target/cucumber-html-report"
def JSONPath = "${pwd()}/target/cucumber-json-report.json"

step([$class: 'CucumberReportPublisher', 
            jsonReportDirectory: '${ReportPath}', 
            fileIncludePattern: '${JSONPath}'])
我不熟悉DSL脚本,有人能帮我解释一下我在这里做错了什么吗?为什么cucumber报告没有在这里生成

提前感谢您的帮助

谢谢

注意:我们使用的是最新的cucumber报告版本

stage "Publish Reports"
echo "***** Publish Reports *****"
def ReportPath = "${pwd()}/target/cucumber-html-report"
def JSONPath = "${pwd()}/target/cucumber-reports"

steps.step([$class: 'CucumberReportPublisher', 
        jsonReportDirectory: '${JSONPath}', 
        fileIncludePattern: '*.json'
所以您必须在“jsonReportDirectory”中指定json根路径,并且文件模式应为“.json”

“CucumberReportPublisher”类本身查找jsonReportDirectory中存在的所有.json文件