How can I publish the results of the code coverage to the trend graph even if the job fails after the jacoco analysis?
For Findbugs, PMD, etc. this can be achieved with the canRunOnFailed
setting. Is there something similar for JaCoCo?

- 1,103
- 1
- 6
- 18
1 Answers
On project level I see the trend graph which only considers the successful builds. I would also like to see the coverage graph updated if the job fails.
This is tracked by JENKINS-28479:
ProjectActions (and trend graphs) do not appear for failed projects
This problem is not only related to the JUnit plug-in. In general, every plug-in that has been migrated its actions to a SimpleBuildStep has this problem. The affected source code is in
SimpleBuildStep
.A test case that exposes this bug is WarningsPluginTest#should_not_skip_failed_builds_with_option_run_always
This is still open.
Original answer:
This is not specific to the maven jacoco build step: all you need to do is make sure that build step always return "success".
If you are using pipelines, you can wrap your step in a try/catch.
If you are using a regular job definition, you could consider a shell/windows command step where you return 0 (or exit /b 0
) after the mvn command.
The next build step would be the mvn sonar:sonar
publication one, which will then always be executed.
-
Sorry I was not specific enough. The JaCoCo results are published, I can see the results in job execution. However on project level I see the **trend graph** which only considers the successful builds. I would also like to see the coverage graph updated if the job fails. – Christopher Apr 19 '17 at 07:49
-
@Christopher OK. I have edited the answer accordingly, with a reference to the relevant Jenkins issue. – VonC Apr 19 '17 at 08:29
-
Not a satisfying answer, but at least I now know where to look if the issue was fixed. Thanks. – Christopher Apr 19 '17 at 10:01