Sagnik Kundu
Sagnik Kundu

Reputation: 431

Getting an "Error while reading the sourcefile!" error from Jenkins jacoco plugin

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

error page

Upvotes: 5

Views: 2092

Answers (1)

Roi Addi
Roi Addi

Reputation: 263

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

Upvotes: 10

Related Questions