0

I am using Sonar on Linux with project in Java using Ant. I have a multi-module development project. I have been able to import multiple source folders, test folders, and binary folders. Unit test reports are also imported fine since all reports are in one folder. However, our Cobertura reports are generated into several folders like this:

./coberturaReports/module1/coverage.xml
./coberturaReports/module2/coverage.xml

defining the path to reports like this does not work: ./coberturaReports/**/coverage.xml

Any ideas? Thanks

user1340582
  • 19,151
  • 35
  • 115
  • 171

1 Answers1

-1

If this is a multimodule project, then you should have a look at one of our Ant multi-module example: https://github.com/SonarSource/sonar-examples/tree/master/projects/code-coverage/ut/ant/ut-ant-jacoco-modules-runTests

It uses JaCoCo as coverage engine, but the principle remains the same.

  • I had a look at it. We have staid clear of decorating our projects with Ant scripts. We have an ant target that gathers the source files from the different Java projects and outputs the binaries into a separate project. Tests are handled the same and they are instrumented with Cobertura in the test targets. The Cobertura reports are therefore outputted also into a separate project, but into the folders as stated in my original post. Maybe it is possible to merge the coverage reports before inputting to Sonar? – user1340582 Oct 02 '12 at 10:01
  • So it looks like in the project you mentioned above, sources binaries, unit test reports, and cobertura reports are generated inside separate modules. That is fine, as I have pretty much the same situation. Looking at the main level build.xml file, I don't quite see where/how the magic happens. Jacoco is still set to search for the coverage report from the one target destination? – user1340582 Oct 02 '12 at 15:12
  • The link in this answer gives a 404 now. – dobey Jul 28 '15 at 19:27