title: sonar ant task or hudson intergration for coverage report
body: <p>Good morning, i've got a question about cobertura report integration in sonar.
  I've tried two way: from hudson and from ant task.
  if  i used hudson to configure a sonar integration, the cobertura report is well integrated to my sonar dashboard but i've got some warning like</p>
  
  <pre><code>Java bytecode scan... 
  [WARN]  Class 'javax/mail/Folder' is not accessible through the ClassLoader.
  [WARN]  Class 'javax/mail/Folder' is not accessible through the ClassLoader.
  [WARN]  Class 'javax/mail/Folder' is not accessible through the ClassLoader.
  [WARN]  Class 'javax/mail/Folder' is not accessible through the ClassLoader.
  [WARN]  Class 'com/sun/mail/imap/IMAPFolder' is not accessible through the ClassLoader.
  </code></pre>
  
  <p>But, my cobertura report is well integrated:</p>
  
  <pre><code> [INFO]  Sensor CoberturaSensor...
   [INFO]  parsing C:\hudson\jobs\Client Mail\workspace\cobertura\reports\coverage.xml
   [INFO]  Sensor CoberturaSensor done: 1218 ms
  </code></pre>
  
  <p>So, i decide to use ant task so i can manage my librairies, this is my ant task:</p>
  
  <pre><code> &lt;target name="sonar" depends="cover-report"&gt;
  &lt;!-- The workDir directory is used by Sonar to store temporary files --&gt;
  &lt;sonar:sonar workDir="./" key="fr.simscorps:client.mail" version="0.1-SNAPSHOT" xmlns:sonar="antlib:org.sonar.ant"&gt;
  &lt;property key="sonar.host.url" value="http://172.30.3.55:1234/sonar/" /&gt;
    &lt;!-- source directories (required) --&gt;
    &lt;sources&gt;
      &lt;path location="./src" /&gt;
    &lt;/sources&gt;
  
    &lt;!-- list of properties (optional) --&gt;
    &lt;property key="sonar.dynamicAnalysis" value="reuseReports" /&gt;
    &lt;property key="sonar.projectName" value="client mail" /&gt;
    &lt;property key="sonar.java.source" value="1.5" /&gt;
    &lt;property key="sonar.projectVersion" value="0.1-SNAPSHOT" /&gt; 
    &lt;property key="sonar.phase" value="generate-sources"/&gt;
    &lt;property key="sonar.cobertura.reportsPath" value="${reports.xml.dir}/coverage.xml"/&gt;
    &lt;property key="sonar.surefire.reportsPath" value="${reports.xml.dir}/TESTS-test.TestSuiteClientMail.xml" /&gt;
  
  
  
    &lt;!-- test source directories (optional) --&gt;
    &lt;tests&gt;
      &lt;path location="./test" /&gt;
    &lt;/tests&gt;
  
    &lt;!-- binaries directories, which contain for example the compiled Java bytecode (optional) --&gt;
    &lt;binaries&gt;
      &lt;path location="./bin" /&gt;
    &lt;/binaries&gt;
  
    &lt;!-- path to libraries (optional). These libraries are for example used by the Java Findbugs plugin --&gt;
    &lt;libraries&gt;
      &lt;path location="./lib/activation.jar" /&gt;
      &lt;path location="./lib/deltasync.jar" /&gt;
      &lt;path location="./lib/jaybird_full_2_1_6.jar" /&gt;
      &lt;path location="./lib/junit.jar" /&gt;
      &lt;path location="./lib/mail.jar" /&gt;
      &lt;path location="./lib/libdeltasync/apache-mime4j-0.5.jar"/&gt;
      &lt;path location="./lib/libdeltasync/commons-codec-1.5.jar"/&gt;
      &lt;path location="./lib/libdeltasync/commons-codec-1.5-javadoc.jar"/&gt;
      &lt;path location="./lib/libdeltasync/commons-codec-1.5-sources.jar"/&gt;
      &lt;path location="./lib/libdeltasync/commons-logging-1.1.1.jar"/&gt;
      &lt;path location="./lib/libdeltasync/httpclient-4.1.1.jar"/&gt;
      &lt;path location="./lib/libdeltasync/httpclient-cache-4.1.1.jar"/&gt;
      &lt;path location="./lib/libdeltasync/httpcore-4.1.jar"/&gt;
      &lt;path location="./lib/libdeltasync/httpmime-4.1.1.jar"/&gt;
      &lt;path location="./lib/libdeltasync/logback-classic-0.9.29.jar"/&gt;
      &lt;path location="./lib/libdeltasync/logback-classic-0.9.29-sources.jar"/&gt;
      &lt;path location="./lib/libdeltasync/logback-core-0.9.29.jar"/&gt;
      &lt;path location="./lib/libdeltasync/logback-core-0.9.29-sources.jar"/&gt;
      &lt;path location="./lib/libdeltasync/slf4j-api-1.6.1.jar"/&gt;
      &lt;path location="./lib/libdeltasync/slf4j-api-1.6.1-sources.jar"/&gt;
    &lt;/libraries&gt;
  &lt;/sonar:sonar&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>My report is well generated (about 700ko) and in hudson's log i see the cobertura sensor, but it's like he didn't do anything:</p>
  
  <pre><code>[sonar:sonar] [INFO]  Sensor CoberturaSensor...
  [sonar:sonar] [INFO]  Sensor CoberturaSensor done: 0 ms
  </code></pre>
  
  <p>Here, my other ant task dependency:</p>
  
  <pre><code> &lt;property name="junit.output.dir" value="junit"/&gt;
  &lt;property name="instrumented.dir" value="cobertura/instrumented"/&gt;
  &lt;property name="classes.dir" value="bin"/&gt;
  &lt;property name="jars.dir" value="lib"/&gt;
  &lt;property name="test.dir" value="test"/&gt;
  &lt;property name="cobertura.dir" value="${jars.dir}/cobertura"/&gt;
  &lt;property name="reports.xml.dir" value="cobertura/reports"/&gt;
  &lt;property name="cob.ser.file" value="cobertura.ser" /&gt;
  
   &lt;!-- Define the Sonar task if this hasn't been done in a common script --&gt;
     &lt;taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"&gt;
     &lt;classpath path="C:\hudson\tools\my_ant\lib" /&gt;
     &lt;/taskdef&gt;
  
  &lt;path id="cobertura.classpath"&gt;
      &lt;fileset dir="${cobertura.dir}"&gt;
          &lt;include name="cobertura.jar" /&gt;
          &lt;include name="lib/**/*.jar" /&gt;
      &lt;/fileset&gt;
      &lt;fileset dir="${jars.dir}"&gt;
          &lt;include name="**/*.jar"/&gt;
      &lt;/fileset&gt;
  &lt;/path&gt;
  
  &lt;taskdef classpathref="cobertura.classpath" resource="tasks.properties" /&gt;
  &lt;target name="clean" &gt;
      &lt;delete dir="${instrumented.dir}" /&gt;
      &lt;delete dir="${reports.xml.dir}" /&gt;
      &lt;delete file="${cob.ser.file}" /&gt;
  &lt;/target&gt;
  
  &lt;target name="prepare" depends="clean"&gt;
          &lt;mkdir dir="${instrumented.dir}" /&gt;
          &lt;mkdir dir="${reports.xml.dir}" /&gt;
  &lt;/target&gt;
  &lt;target name="instrument" depends="prepare"&gt;
      &lt;cobertura-instrument todir="${instrumented.dir}"&gt;
              &lt;ignore regex="org.apache.log4j.*" /&gt;
              &lt;fileset dir="${classes.dir}"&gt;
                  &lt;include name="**/*.class" /&gt;
                  &lt;exclude name="**/*Test.class" /&gt;
              &lt;/fileset&gt;
  
          &lt;/cobertura-instrument&gt;
  &lt;/target&gt;
  
  
  
  &lt;target name="testsuite" depends="instrument"&gt;
      &lt;junit fork="yes" dir="${test.dir}" failureProperty="test.failed"  printsummary="withOutAndErr"&gt;
              &lt;!--
                  Specify the name of the coverage data file to use.
                  The value specified below is the default.
              --&gt;
              &lt;sysproperty key="net.sourceforge.cobertura.datafile"
                  file="${basedir}/cobertura.ser" /&gt;
              &lt;!--
                  Note the classpath order: instrumented classes are before the
                  original (uninstrumented) classes.  This is important.
              --&gt;
              &lt;classpath location="${instrumented.dir}" /&gt;
              &lt;classpath location="${classes.dir}" /&gt;
  
              &lt;!--
                  The instrumented classes reference classes used by the
                  Cobertura runtime, so Cobertura and its dependencies
                  must be on your classpath.
              --&gt;
              &lt;classpath refid="cobertura.classpath" /&gt;
  
              &lt;formatter type="xml" /&gt;
              &lt;test name="test.TestSuiteClientMail" todir="${reports.xml.dir}" /&gt;
  
              &lt;!--&lt;batchtest todir="${reports.xml.dir}" unless="testcase"&gt;
                  &lt;fileset dir="${test.dir}"&gt;
                      &lt;include name="**/*Test*.java" /&gt;
                  &lt;/fileset&gt;
              &lt;/batchtest&gt;--&gt;
          &lt;/junit&gt;
  &lt;/target&gt;
  
  &lt;target name="cover-report" depends="testsuite"&gt;
      &lt;cobertura-report format="xml" destdir="${reports.xml.dir}" srcdir="${test.dir}" /&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>Does anyone have an idea?</p>