title: sonar coverage in preview mode
body: <p>I've got a question about code coverage in sonar preview mode.</p>
  
  <p>I'm trying to configure sonar for our project and exploring the sonar's preview and incremental modes. The idea is to run those in continuous manner in CI in feature branches managed by our developers.
  The goal is to give them a clue of the code quality without overwhelming our sonarcube and its db.</p>
  
  <p>I see that when running the sonar in preview mode it generates a report in json format, since I stick to defaults, it resides in:</p>
  
  <pre><code>target\sonar\sonar-report.json
  </code></pre>
  
  <p>However this report doesn't contain any information about code coverage, only about violations.</p>
  
  <p><strong>So, my question is how its possible to include the information about the coverage when running sonar in preview and possibly incremental mode?</strong></p>
  
  <p>There are a lot of half-correct answers here in there in internet but I couldn't find a working solution so far. </p>
  
  <p>I use the latest available sonar cube (5.1.2)
  Maven 3.3.3 is our build tool.</p>
  
  <p>The coverage is jacoco driven, so I run the following commands:</p>
  
  <p>For running the tests themselves</p>
  
  <pre><code>mvn org.jacoco:jacoco-maven-plugin:0.7.4.201502262128:prepare-agent clean install -Pcoverage-per-test
  </code></pre>
  
  <p>For running the sonar:</p>
  
  <pre><code>mvn sonar:sonar -Dsonar.dynamicAnalysis=reuseReports -Dsonar.analysis.mode=preview -Dsonar.java.coveragePlugin=jacoco
  </code></pre>
  
  <p>As for the coverage-per-test profile, I've got the following configuration:</p>
  
  <pre><code>&lt;profile&gt;
    &lt;id&gt;coverage-per-test&lt;/id&gt;
    &lt;build&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
          &lt;!-- Minimal supported version is 2.4 --&gt;
          &lt;version&gt;2.13&lt;/version&gt;
          &lt;configuration&gt;
            &lt;properties&gt;
              &lt;property&gt;
                &lt;name&gt;listener&lt;/name&gt;
                &lt;value&gt;org.sonar.java.jacoco.JUnitListener&lt;/value&gt;
              &lt;/property&gt;
            &lt;/properties&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.codehaus.sonar-plugins.java&lt;/groupId&gt;
        &lt;artifactId&gt;sonar-jacoco-listeners&lt;/artifactId&gt;
        &lt;version&gt;1.2&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p>I'm pretty much a newbie in a sonar world so any help will be appreciated. </p>
  
  <p>Thanks a lot in advance</p>