Can anyone suggest if there is a way to execute Jacoco in a Jenkins Pipeline? I have downloaded the plugin but I do not get the option for Jacoco in the 'Pipeline Syntax', which is the Pipeline script help .
Referred this URL: https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin which has no information for a jenkins jacoco pipeline
Run the job [JaCoCo plugin] build/*. exec;build/*-classes;src/java,src/*/java,src/*/src; locations are configured [JaCoCo plugin] Number of found exec files: 5 [JaCoCo plugin] Saving matched execfiles: .../build/jacoco-excelant. exec .../build/jacoco-main. exec .../build/jacoco-ooxml-lite.
If you click on the Coverage Report icon, you will see code coverage for each package in your application, and even drill down to see the code coverage (or lack thereof) for an individual class (see Figure 2.31, “Jenkins lets you display code coverage metrics for packages and classes”).
The jacoco pipeline step configuration uses this format:
step([$class: 'JacocoPublisher', execPattern: 'target/*.exec', classPattern: 'target/classes', sourcePattern: 'src/main/java', exclusionPattern: 'src/test*' ])
Or with a simpler syntax for declarative pipeline:
jacoco( execPattern: 'target/*.exec', classPattern: 'target/classes', sourcePattern: 'src/main/java', exclusionPattern: 'src/test*' )
You can find more options in the JaCoCo Pipeline Steps Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With