title: Sonar reports different line and branch coverage than Idea, Eclipse, Maven and Jenkins
body: <p>I have all those tools reporting the same coverage with JaCoCo: 69% line coverage and 23% branch coverage.</p>
  
  <p><em>Note: Screenshots had been taken over several days so they have slightly different values, but the variance is &lt; 1%</em></p>
  
  <p>Jenkins:
  <a href="https://i.stack.imgur.com/BzHcX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BzHcX.png" alt="jenkins"></a></p>
  
  <p>Maven:
  <a href="https://i.stack.imgur.com/YqTKw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YqTKw.png" alt="maven"></a></p>
  
  <p>Eclipse:
  <a href="https://i.stack.imgur.com/ei11E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ei11E.png" alt="eclipse"></a></p>
  
  <p>However Sonar reports different values: </p>
  
  <p><a href="https://i.stack.imgur.com/36GLu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/36GLu.png" alt="sonar"></a></p>
  
  <p>Maven project is structured as follows:</p>
  
  <ul>
  <li>main (aggregator)
  
  <ul>
  <li>java module</li>
  <li>js (node) module</li>
  </ul></li>
  </ul>
  
  <p>You can see the same coverage reported on main and java modules, and no coverage for the js one.</p>
  
  <p><a href="https://i.stack.imgur.com/ry8eG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ry8eG.png" alt="Modules"></a></p>
  
  <p>I'm using the latest versions of <code>jacoco</code>, <code>jacoco-maven-plugin</code> and Sonar's <code>Java Plugin</code>.</p>
  
  <p>Here are the relevant build log fragments from <code>mvn sonar:sonar</code> -- all seem to be in order:</p>
  
  <pre><code>$ egrep -i 'jacoco|\[warn]' consoleText
  [WARN] [04:34:29.569] 'sonar.dynamicAnalysis' is deprecated since version 4.3 and should no longer be used.
  [WARN] [04:34:29.576] 'sonar.dynamicAnalysis' is deprecated since version 4.3 and should no longer be used.
  [WARN] [04:34:29.593] 'sonar.dynamicAnalysis' is deprecated since version 4.3 and should no longer be used.
  [INFO] [04:34:32.704] JaCoCoItSensor: JaCoCo IT report not found: /home/acme/workspace/example-Sonar-DSL/modules/example-main/target/jacoco-it.exec
  [WARN] [04:34:32.952] Bytecode of dependencies was not provided for analysis of test files, you might end up with less precise results. Bytecode can be provided using sonar.java.test.libraries property
  [WARN] [04:34:50.101] Cobertura report not found at /home/acme/workspace/example-Sonar-DSL/modules/example-main/target/site/cobertura/coverage.xml
  [INFO] [04:35:03.391] Sensor JaCoCoSensor
  [INFO] [04:35:03.406] Analysing /home/acme/workspace/example-Sonar-DSL/modules/example-main/target/jacoco.exec
  [INFO] [04:35:03.712] Sensor JaCoCoSensor (done) | time=321ms
  [INFO] [04:35:03.712] Sensor JaCoCoOverallSensor
  [INFO] [04:35:03.714] Analysing /home/acme/workspace/example-Sonar-DSL/modules/example-main/target/jacoco.exec
  [INFO] [04:35:03.762] Analysing /home/acme/workspace/example-Sonar-DSL/modules/example-main/target/sonar/jacoco-overall.exec
  [INFO] [04:35:03.906] Sensor JaCoCoOverallSensor (done) | time=194ms
  [INFO] [04:35:11.013] JaCoCoSensor: JaCoCo report not found : /home/acme/workspace/example-Sonar-DSL/modules/frontend/target/jacoco.exec
  [INFO] [04:35:11.013] JaCoCoItSensor: JaCoCo IT report not found: /home/acme/workspace/example-Sonar-DSL/modules/frontend/target/jacoco-it.exec
  [INFO] [04:35:11.179] JaCoCoSensor: JaCoCo report not found : /home/acme/workspace/example-Sonar-DSL/target/jacoco.exec
  [INFO] [04:35:11.179] JaCoCoItSensor: JaCoCo IT report not found: /home/acme/workspace/example-Sonar-DSL/target/jacoco-it.exec
  </code></pre>
  
  <p><strong>Is this a bug in Sonar's Java Plugin?</strong> 
  I think it's highly unlikely that metric reported by sonar is correct when 3 other tools configured by different people consistently show different values.</p>