简体   繁体   中英

Using Sonar in Ant only for code coverage with JaCoCo (no static analysis)

I created a job in Jenkins that executes sonnar-runner against all the projects in my repository. This job is independent from code coverage and runs a few times a day.

On the other hand, I want code coverage to happen upon a build (using JaCoCo) and import the reports into Sonar using Ant.

I set up my environment and added the JaCoCo and Sonar plug-ins to the Ant lib directory. When I run the Ant target I can see the results of JaCoCo locally in XML and HTML.

All I want is to upload these results to a remote SonarQube instance. However, after setting up the Sonar properties and adding <sonar:sonar> to my build.xml I realized that Sonar seems to be running static analysis against my project.

How do I set up Ant to only run code coverage for a project?

You can't run only a small portion of the full analysis.

Imagine for a moment that this were possible: Let's say that once an hour a "coverage only" job runs that updates the coverage on my project.

  • At 8 am I start with a project with 6 LoC and 50% coverage.
  • At 9 am my project has "6 LoC" and 20% coverage
  • 10a.m.: "6 Loc" and 10% coverage.

Has someone been removing tests? Or adding new, uncovered LoC?

I have no way of knowing because my partial analysis has put the SonarQube project in a bad state.

And this is why there's no way to run only part of the analysis.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM