title: Exclude packages from Jacoco report using Sonarrunner and Gradle
body: <p>Is there a way to exclude packages from SonarQube(instrumented by gradle + sonar-runner) coverage reports(generated by jacoco) without excluding them completely from the project ?</p>
  
  <p>Below is what i tried so far:</p>
  
  <h2>Version information</h2>
  
  <ul>
  <li>SonarQube 4.5.1</li>
  <li>Gradle 2.2.</li>
  </ul>
  
  <h2>Jacoco configuration</h2>
  
  <pre><code>// JaCoCo test coverage configuration
  tasks.withType(Test) { task -&gt;
      jacoco {
          append = false
  
          // excluded classes from coverage defined in above configuration
          excludes = excludedClasses()
      }
  
      jacocoTestReport {
          doFirst {
              classDirectories = fileTree(dir: "${buildDir}/classes/main/").exclude(excludedClasses())
          }
      }
  
  }
  </code></pre>
  
  <h2>Sonarrunner configuration</h2>
  
  <p>Property setting to exclude package from Sonar analysis. Adding this to my configuration lead to the situation that the packages do not show-up at all in Sonar.</p>
  
  <pre><code>property 'sonar.exclusions', excludedClasses().join(',')
  </code></pre>
  
  <hr>
  
  <p>Property setting to exclude packages from jacoco. Setting this leads to the situation that packages are excluded from coverage analysis however show up having 0% which accumulates to bad total scores.</p>
  
  <pre><code>property 'sonar.jacoco.exclusions', excludedClasses().join(',')
  </code></pre>