【发布时间】:2023-04-06 14:23:01
【问题描述】:
当我使用 Jacoco 插件时,Jenkins 管道错误并出现空指针异常。如果我从 Jenkinsfile 中注释掉 Jacoco 步骤,则不会引发错误。 Jenkins 中的日志文件表明该错误是在 End of Pipeline 之后抛出的。 以下是日志消息和 Jenkins 文件详细信息。知道为什么会抛出此错误吗?
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NullPointerException
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:87)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:70)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
Jenkins 文件 ....
pipeline{
agent any
stages{
stage('Git clone project'){
steps{
git branch: 'sandbox',url:'https://<repo url>'
sh 'git branch -a'
}
}
stage('Test TMS'){
steps{
dir('TestManagementService'){
sh 'pwd'
sh './gradlew test'
step(
jacoco(
execPattern: '**/build/jacoco/**.exec',
classPattern: '**/build/classes/java/main',
sourcePattern: '**/src',
inclusionPattern: 'com/testMgmt/**',
)
)
}
}
post{
always{
junit '**/build/test-results/test/TEST-*.xml'
}
}
}
}// end of stages
}
【问题讨论】:
-
如果这种用法是正确的(而且看起来是正确的),那么您可能需要为插件提交错误报告。
-
JIRA issues.jenkins.io/browse/JENKINS-67333> 已记录
标签: jenkins jenkins-pipeline jacoco