Coverage API: jacoco instead of jacocoAdapter

392 views
Skip to first unread message

Sverre Moe

unread,
Mar 6, 2020, 3:52:54 AM3/6/20
to Jenkins Users
Publish Coverage from JaCoCo using the new Coverage API:

It makes a statement in this blog:
publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')]
You can also use jacoco instead of jacocoAdapter if you didn't install Jacoco-Plugin.

What does this mean? That I could use the jacoco pipeline within publishCoverage:
jacoco classPattern: 'build/classes', execPattern: 'build/jacoco/*.exec'

In order to use the JaCoCo Adapter, I would need to run jacoco to generate the test report as part of my build with Gradle.
./gradlew jacocoTestReport

Then use the output from it in publishCoverage:
publishCoverage adapters: [jacocoAdapter('build/reports/jacoco/test/jacocoTestReport.xml')]

But if the implication of the statement made in the blog is what I think it means, I would not need to run jacocoTestReport.
However the Snippet generator does not allow for it, so I am not sure.


Ullrich Hafner

unread,
Mar 6, 2020, 6:25:34 AM3/6/20
to Jenkins Users
It simply means that you can use the symboled `jacoco` in your pipeline if you do not have the jacoco-plugin installed. Otherwise you need to use the name `jacocoAdapter` (both symbols refer to the same thing). Since the jacoco plugin also provides a step with the symbol `jacoco` your pipeline will have a syntax error (name clash) because you use a symbol that is located in multiple plugins. To be on the save side: always use jacocoAdapter.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/67662343-72e7-4c65-9e51-833bab959a71%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages