title: SonarQube: uploading Cobertura results using Maven
body: <p>I am using Maven with the Cobertura and SonarQube plug-ins. I want the results in <code>cobertura.ser</code> to be uploaded to SonarQube. This is my <code>pom.xml</code>:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;delta.coverage.mvp&lt;/groupId&gt;
    &lt;artifactId&gt;delta.coverage.mvp&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.12&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;sonar.host.url&gt;http://192.168.1.10:9000&lt;/sonar.host.url&gt;
      &lt;sonar.jdbc.driverClassName&gt;org.h2.Driver&lt;/sonar.jdbc.driverClassName&gt;
      &lt;sonar.language&gt;java&lt;/sonar.language&gt;
      &lt;sonar.dynamicAnalysis&gt;reuseReports&lt;/sonar.dynamicAnalysis&gt;
      &lt;sonar.login&gt;admin&lt;/sonar.login&gt;
      &lt;sonar.password&gt;adminpwd&lt;/sonar.password&gt;
      &lt;sonar.projectKey&gt;delta.coverage.mvp&lt;/sonar.projectKey&gt;
      &lt;sonar.projectName&gt;delta.coverage.mvp&lt;/sonar.projectName&gt;
      &lt;sonar.projectVersion&gt;test&lt;/sonar.projectVersion&gt;
      &lt;sonar.sources&gt;src/main/java&lt;/sonar.sources&gt;
      &lt;sonar.java.coveragePlugin&gt;cobertura&lt;/sonar.java.coveragePlugin&gt;
      &lt;sonar.junit.reportsPath&gt;${project.basedir}/target/surefire-reports&lt;/sonar.junit.reportsPath&gt;
      &lt;sonar.surefire.reportsPath&gt;${project.basedir}/target/surefire-reports&lt;/sonar.surefire.reportsPath&gt;
      &lt;sonar.cobertura.reportPath&gt;${project.basedir}/target/cobertura/cobertura.ser&lt;/sonar.cobertura.reportPath&gt;
    &lt;/properties&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.7&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;instrumentation&gt;
                      &lt;includes&gt;
                          &lt;include&gt;**/*.class&lt;/include&gt;
                      &lt;/includes&gt;
                  &lt;/instrumentation&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;clean&lt;/id&gt;
                      &lt;phase&gt;pre-site&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;clean&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
                  &lt;execution&gt;
                      &lt;id&gt;instrument&lt;/id&gt;
                      &lt;phase&gt;site&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;instrument&lt;/goal&gt;
                          &lt;goal&gt;cobertura&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  
          &lt;!-- SonarQube Plugin --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.sonarsource.scanner.maven&lt;/groupId&gt;
              &lt;artifactId&gt;sonar-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.0.2&lt;/version&gt;
          &lt;/plugin&gt;
  
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;reporting&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;!-- use mvn cobertura:cobertura to generate cobertura reports --&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.7&lt;/version&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/reporting&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I am running <code>mvn clean cobertura:cobertura sonar:sonar</code> in order to build, unit-test (with coverage) and analyze the code+upload the unit test results. The analysis (SonarQube scan) is uploaded successfully. However, the Cobertura results are not uploaded to SonarQube. Instead, the log shows that Maven actually looked for JaCoCo files:</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building delta.coverage.mvp 0.0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ delta.coverage.mvp ---
  [INFO] Deleting /home/phil/git/delta-coverage-mvp/target
  [INFO] 
  [INFO] &gt;&gt;&gt; cobertura-maven-plugin:2.7:cobertura (default-cli) &gt; [cobertura]test @ delta.coverage.mvp &gt;&gt;&gt;
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ delta.coverage.mvp ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] Copying 0 resource
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ delta.coverage.mvp ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 1 source file to /home/phil/git/delta-coverage-mvp/target/classes
  [INFO] 
  [INFO] --- cobertura-maven-plugin:2.7:instrument (default-cli) @ delta.coverage.mvp ---
  [INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
  [INFO] Cobertura: Saved information on 1 classes.
  [INFO] Cobertura: Saved information on 1 classes.
  
  [INFO] Instrumentation was successful.
  [INFO] NOT adding cobertura ser file to attached artifacts list.
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ delta.coverage.mvp ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] Copying 0 resource
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ delta.coverage.mvp ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 1 source file to /home/phil/git/delta-coverage-mvp/target/test-classes
  [INFO] 
  [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ delta.coverage.mvp ---
  [INFO] Surefire report directory: /home/phil/git/delta-coverage-mvp/target/surefire-reports
  
  -------------------------------------------------------
   T E S T S
  -------------------------------------------------------
  Running delta.coverage.mvp.package1.Test1
  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.202 sec
  [INFO] Cobertura: Loaded information on 1 classes.
  [INFO] Cobertura: Saved information on 1 classes.
  
  Results :
  
  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  
  [INFO] 
  [INFO] &lt;&lt;&lt; cobertura-maven-plugin:2.7:cobertura (default-cli) &lt; [cobertura]test @ delta.coverage.mvp &lt;&lt;&lt;
  [INFO] 
  [INFO] --- cobertura-maven-plugin:2.7:cobertura (default-cli) @ delta.coverage.mvp ---
  [INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
  [INFO] Cobertura: Loaded information on 1 classes.
  Report time: 108ms
  
  [INFO] Cobertura Report generation was successful.
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building delta.coverage.mvp 0.0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- sonar-maven-plugin:3.0.2:sonar (default-cli) @ delta.coverage.mvp ---
  [INFO] User cache: /home/phil/.sonar/cache
  [INFO] Load global repositories
  [INFO] Load global repositories (done) | time=517ms
  [INFO] User cache: /home/phil/.sonar/cache
  [INFO] Load plugins index
  [INFO] Load plugins index (done) | time=116ms
  [INFO] SonarQube version: 5.6.1
  [INFO] Default locale: "en_US", source code encoding: "UTF-8"
  [INFO] Process project properties
  [INFO] Load project repositories
  [INFO] Load project repositories (done) | time=193ms
  [INFO] Load quality profiles
  [INFO] Load quality profiles (done) | time=143ms
  [INFO] Load active rules
  [INFO] Load active rules (done) | time=1824ms
  [WARNING] 'sonar.dynamicAnalysis' is deprecated since version 4.3 and should no longer be used.
  [INFO] Publish mode
  [INFO] -------------  Scan delta.coverage.mvp
  [INFO] Language is forced to java
  [INFO] Load server rules
  [INFO] Load server rules (done) | time=966ms
  [INFO] Base dir: /home/phil/git/delta-coverage-mvp
  [INFO] Working dir: /home/phil/git/delta-coverage-mvp/target/sonar
  [INFO] Source paths: src/main/java
  [INFO] Test paths: src/test/java
  [INFO] Binary dirs: target/classes
  [INFO] Source encoding: UTF-8, default locale: en_US
  [INFO] Index files
  [INFO] 2 files indexed
  [INFO] Quality profile for java: Cloud Managed Services - 201503
  [INFO] JaCoCoSensor: JaCoCo report not found : /home/phil/git/delta-coverage-mvp/target/jacoco.exec
  [INFO] JaCoCoItSensor: JaCoCo IT report not found: /home/phil/git/delta-coverage-mvp/target/jacoco-it.exec
  [INFO] Sensor JavaSquidSensor
  [INFO] Configured Java source version (sonar.java.source): none
  [INFO] JavaClasspath initialization...
  [INFO] JavaClasspath initialization done: 12 ms
  [INFO] JavaTestClasspath initialization...
  [INFO] JavaTestClasspath initialization done: 4 ms
  [INFO] Java Main Files AST scan...
  [INFO] 1 source files to be analyzed
  [INFO] Java Main Files AST scan done: 193 ms
  [INFO] 1/1 source files have been analyzed
  [INFO] Java bytecode scan...
  [INFO] Java bytecode scan done: 18 ms
  [INFO] Java Test Files AST scan...
  [INFO] 1 source files to be analyzed
  [INFO] Java Test Files AST scan done: 56 ms
  [INFO] 1/1 source files have been analyzed
  [INFO] Package design analysis...
  [INFO] Package design analysis done: 4 ms
  [INFO] Sensor JavaSquidSensor (done) | time=560ms
  [INFO] Sensor Lines Sensor
  [INFO] Sensor Lines Sensor (done) | time=1ms
  [INFO] Sensor SurefireSensor
  [INFO] parsing /home/phil/git/delta-coverage-mvp/target/surefire-reports
  [INFO] Sensor SurefireSensor (done) | time=54ms
  [INFO] Sensor SCM Sensor
  [INFO] SCM provider for this project is: git
  [INFO] 2 files to be analyzed
  [INFO] 0/2 files analyzed
  [WARNING] Missing blame information for the following files:
  [WARNING]   * /home/phil/git/delta-coverage-mvp/src/main/java/delta/coverage/mvp/package1/Class1.java
  [WARNING]   * /home/phil/git/delta-coverage-mvp/src/test/java/delta/coverage/mvp/package1/Test1.java
  [WARNING] This may lead to missing/broken features in SonarQube
  [INFO] Sensor SCM Sensor (done) | time=112ms
  [INFO] Sensor Zero Coverage Sensor
  [INFO] Sensor Zero Coverage Sensor (done) | time=5ms
  [INFO] Sensor Code Colorizer Sensor
  [INFO] Sensor Code Colorizer Sensor (done) | time=1ms
  [INFO] Sensor CPD Block Indexer
  [INFO] JavaCpdBlockIndexer is used for java
  [INFO] Sensor CPD Block Indexer (done) | time=159ms
  [INFO] Calculating CPD for 1 files
  [INFO] CPD calculation finished
  [INFO] Analysis report generated in 57ms, dir size=13 KB
  [INFO] Analysis reports compressed in 14ms, zip size=8 KB
  [INFO] Analysis report uploaded in 218ms
  [INFO] ANALYSIS SUCCESSFUL, you can browse http://192.168.1.10:9000/dashboard/index/delta.coverage.mvp
  [INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
  [INFO] More about the report processing at http://192.168.1.10:9000/api/ce/task?id=AVbYSBOBTyY3I5vbl2iO
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 12.175 s
  [INFO] Finished at: 2016-08-29T16:50:17-05:00
  [INFO] Final Memory: 31M/666M
  [INFO] ------------------------------------------------------------------------
  </code></pre>