My source code is written in scala. I have used sbt-jacoco sbt plugin of version 3.0.3 for code coverage. Jenkins plugin used is JaCoCo Plugin of version 3.0.1
I have implemented jacoco within my Jenkinsfile as :
step([$class: 'JacocoPublisher', sourcePattern: '**/src'])
The plugin works perfectly fine , shows the code percentages covered and missed. But when I go to check the actual lines of code covered through the Jenkins UI, I get the above error "Error while reading the sourcefile!"
Would you help me figure out what I am doing wrong?
Attached screenshots
look at jenkins log (usually at /var/log/jenkins/jenkins.log
) for exceptions like java.io.FileNotFoundException
to figure out where the plugin think the file located at, or any other errors while trying to read the file.
what solve it for me was setting the sourcePattern to '**/src/*/java'
which by default it is set to '**/src/main/java'
based on git
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