I am using my own repo (not maven central). I zipped up the jacocoagent.jar and jacocoant.jar and dropped the zip files into my repo (see reference under dependencies). I do see 4 xxx.exec files under projectbuilddir/jacoco. but i also see that each time i run the task it is skipped in the log. It would also be nice I would get the condition that the onlyIf is failing on in the log.
Also, I find it funny that jacocoAgent and jacocoAnt are expecting a ZIP file of the corresponding jar and cannot process the jar directly. This causes the jar to be dropped into the directory and then i must .git_ignore it
It is not required to ZIP the JaCoCo JAR files. What makes you think that this is needed? Here’s an example build script that generates the metrics and report with local dependencies:
Keep in mind that the task “jacocoTestReport” does not depend on the “test” task which also generates the exec files. If “jacocoTestReport” can’t find exec files, it will be marked SKIPPED.
well, yesterday when i pointed to the jar directly it was saying expecting ZIP with one file and not found. sorry, but lost the logs as restarted terminal. today, works fine as in your example above.
however, i only get .exec files generated with gradle test and none with gradle jacocotestreport
my thinking, which is probably off, is that jacoco cannot figure out the special naming we had set up when you were here.
ls build/storm/jacoco
javatestsComXxxCommonMathTest.exec
javatestsComXxxExampleHelloTest.exec
javatestsComXxxCommonTimeTest.exec
javatestsComXxxExampleTest.exec
JaCoCo adds an agent to the JVM when executing your tests to generate the code coverage metrics. Trying to add it to the reporting task would be too late. For disabling the generation of code coverage you can set the property “enabled” to false. Have a look at the exposed properties on the plugin page.
The task jacocoTestReport only works for the test task. If your project defines other test task (which is the case in your project), you will need to set up a new JaCoCo test report task. For example: