Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-846

Cobertura plugin doesn't find source code in netbeans project structure

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • cobertura-plugin
    • None
    • Platform: All, OS: All

    Description

      The cobertura plugin claims that it can't find the source code for a HTML
      report, but other parts of the report generation are working.

      Following project strucure and settings (with cobertura 1.9, hudson 1.142,
      cobertura plugin 0.8 ) (inspired by
      http://weblogs.java.net/blog/fabriziogiudici/archive/2006/11/setting_up_netb.html)

      Hudson configure:
      JavaApplication5/build/test/results/coverage.xml

      build.properties
      ================
      C:\Dokumente und Einstellungen\my_name\.netbeans\5.5.1\build.properties

      cobertura.home=D\:\\Programme\\Java
      cobertura-1.9
      cobertura.jar=${cobertura.home}/cobertura.jar
      cobertura.instrumented=/instrumented-classes

      project.properties
      ==================
      C:\Dokumente und
      Einstellungen\my_name\.hudson\jobs\JavaApplikation\workspace\JavaApplication5\nbproject\project.properties

      run.test.classpath=\
      ${cobertura.jar}:\
      ${build.dir}${cobertura.instrumented}:\
      ${javac.test.classpath}:\
      ${build.test.classes.dir}

      build.xml
      =========
      C:\Dokumente und
      Einstellungen\my_name\.hudson\jobs\JavaApplikation\workspace\JavaApplication5\build.xml
      <import file="nbproject/private/ci.xml" optional="true"/>

      <target name="-init-macrodef-junit">
      <echo>My junit was called! ${run.test.classpath}</echo>
      <!-<property file="${user.properties.file}"/>->

      <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">

      <attribute name="includes" default="**/*Test.java"/>
      <sequential>

      <junit showoutput="true" fork="true" dir="${basedir}"
      failureproperty="tests.failed" errorproperty="tests.failed">

      <batchtest todir="${build.test.results.dir}">
      <fileset dir="${test.src.dir}" includes="@

      {includes}

      "/>
      </batchtest>
      <classpath>
      <path path="${run.test.classpath}"/>
      </classpath>
      <syspropertyset>
      <propertyref prefix="test-sys-prop."/>
      <mapper type="glob" from="test-sys-prop." to=""/>
      </syspropertyset>
      <formatter type="brief" usefile="false"/>
      <formatter type="xml"/>
      <jvmarg line="${run.jvmargs}"/>
      </junit>
      </sequential>
      </macrodef>
      </target>

      ci.xml
      ======
      C:\Dokumente und
      Einstellungen\my_name\.hudson\jobs\JavaApplikation\workspace\JavaApplication5\nbproject\private\ci.xml
      <target name="cobertura-instrument" depends="init,compile-test,-pre-test-run">
      <property file="nbproject/project.properties" />
      <!-<property file="nbproject/private/ci.properties" />->
      <path id="cobertura.classpath">
      <fileset dir="${cobertura.home}">
      <include name="cobertura.jar" />
      <include name="lib/*/.jar" />
      </fileset>
      </path>
      <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
      <cobertura-instrument todir="${build.dir}/instrumented-classes">
      <fileset dir="${build.classes.dir}">
      <include name="*/.class"/>
      </fileset>
      </cobertura-instrument>
      </target>

      <target name="test-coverage"

      depends="init,compile-test,-pre-test-run,cobertura-instrument,-do-test-run,test-report,-post-test-run,-test-browse"/>

      <target name="cobertura-coverage-report" depends="test-coverage">
      <property file="nbproject/project.properties"/>
      <!--<path id="cobertura.classpath">
      <fileset dir="${cobertura.home}">
      <include name="cobertura.jar" />
      <include name="lib/*/.jar" />
      </fileset>
      </path>-->
      <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
      <cobertura-report classpathref="cobertura.classpath" format="xml"
      srcdir="${src.dir}" destdir="${build.dir}/test/results" />
      <cobertura-report classpathref="cobertura.classpath" format="html"
      srcdir="${src.dir}" destdir="${build.dir}/test/results" /><!-- I've tested
      several settings here! -->
      <delete file="cobertura.ser" />
      <delete dir="${build.dir}/instrumented-classes" />
      </target>

      Project structure for hudson
      ============================
      C:\Dokumente und Einstellungen\my_name\.hudson
      jobs
      + JavaApplikation
      + builds
      + cobertura (tested with this location too)
      + javadoc
      + workspace
      + JavaApplication5
      + build
      + classes
      + test
      + classes
      + instrumented-classes
      + results (where I put the report initially)
      + dist
      + nbproject
      + private
      + src
      + test

      Attachments

        Activity

          jiai jiai added a comment -

          Content of coverage.xml
          =======================

          <?xml version="1.0"?>
          <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-03.dtd">

          <coverage line-rate="0.5454545454545454" branch-rate="0.5" version="1.9"
          timestamp="1190550797680">
          <sources>
          <source>src</source>
          </sources>
          <packages>
          <package name="de.jiai.demo" line-rate="0.4" branch-rate="0.5" complexity="0.0">
          <classes>
          <class name="de.jiai.demo.Main" filename="de/jiai/demo/Main.java"
          line-rate="0.4" branch-rate="0.5" complexity="0.0">
          <methods>
          <method name="<init>" signature="()V" line-rate="0.0" branch-rate="1.0">
          <lines>
          <line number="25" hits="0" branch="false"/>
          <line number="27" hits="0" branch="false"/>
          </lines>
          </method>
          <method name="main" signature="([Ljava/lang/String;)V"
          line-rate="0.8333333333333334" branch-rate="1.0">
          <lines>
          <line number="35" hits="1" branch="false"/>
          <line number="36" hits="1" branch="false"/>
          <line number="37" hits="1" branch="true" condition-coverage="100% (2/2)">
          <conditions>
          <condition number="0" type="jump" coverage="100%"/>
          </conditions>
          </line>
          <line number="38" hits="52" branch="false"/>
          <line number="41" hits="1" branch="false"/>
          <line number="44" hits="1" branch="false"/>
          <line number="46" hits="1" branch="false"/>
          <line number="49" hits="1" branch="false"/>
          <line number="50" hits="0" branch="false"/>
          <line number="51" hits="0" branch="false"/>
          <line number="52" hits="1" branch="false"/>
          <line number="53" hits="1" branch="false"/>
          </lines>
          </method>
          <method name="main2" signature="([Ljava/lang/String;)V" line-rate="0.0"
          branch-rate="0.0">
          <lines>
          <line number="61" hits="0" branch="false"/>
          <line number="62" hits="0" branch="false"/>
          <line number="63" hits="0" branch="true" condition-coverage="0% (0/2)">
          <conditions>
          <condition number="0" type="jump" coverage="0%"/>
          </conditions>
          </line>
          <line number="64" hits="0" branch="false"/>
          <line number="68" hits="0" branch="false"/>
          <line number="70" hits="0" branch="false"/>
          <line number="73" hits="0" branch="false"/>
          <line number="74" hits="0" branch="false"/>
          <line number="75" hits="0" branch="false"/>
          <line number="76" hits="0" branch="false"/>
          <line number="78" hits="0" branch="false"/>
          </lines>
          </method>
          </methods>
          <lines>
          <line number="25" hits="0" branch="false"/>
          <line number="27" hits="0" branch="false"/>
          <line number="35" hits="1" branch="false"/>
          <line number="36" hits="1" branch="false"/>
          <line number="37" hits="1" branch="true" condition-coverage="100% (2/2)">
          <conditions>
          <condition number="0" type="jump" coverage="100%"/>
          </conditions>
          </line>
          <line number="38" hits="52" branch="false"/>
          <line number="41" hits="1" branch="false"/>
          <line number="44" hits="1" branch="false"/>
          <line number="46" hits="1" branch="false"/>
          <line number="49" hits="1" branch="false"/>
          <line number="50" hits="0" branch="false"/>
          <line number="51" hits="0" branch="false"/>
          <line number="52" hits="1" branch="false"/>
          <line number="53" hits="1" branch="false"/>
          <line number="61" hits="0" branch="false"/>
          <line number="62" hits="0" branch="false"/>
          <line number="63" hits="0" branch="true" condition-coverage="0% (0/2)">
          <conditions>
          <condition number="0" type="jump" coverage="0%"/>
          </conditions>
          </line>
          <line number="64" hits="0" branch="false"/>
          <line number="68" hits="0" branch="false"/>
          <line number="70" hits="0" branch="false"/>
          <line number="73" hits="0" branch="false"/>
          <line number="74" hits="0" branch="false"/>
          <line number="75" hits="0" branch="false"/>
          <line number="76" hits="0" branch="false"/>
          <line number="78" hits="0" branch="false"/>
          </lines>
          </class>
          </classes>
          </package>
          <package name="de.jiai.demo.beans" line-rate="1.0" branch-rate="1.0"
          complexity="1.0">
          <classes>
          <class name="de.jiai.demo.beans.NewBean"
          filename="de/jiai/demo/beans/NewBean.java" line-rate="1.0" branch-rate="1.0"
          complexity="1.0">
          <methods>
          <method name="<init>" signature="()V" line-rate="1.0" branch-rate="1.0">
          <lines>
          <line number="23" hits="4" branch="false"/>
          <line number="25" hits="4" branch="false"/>
          </lines>
          </method>
          <method name="getName" signature="()Ljava/lang/String;" line-rate="1.0"
          branch-rate="1.0">
          <lines>
          <line number="37" hits="2" branch="false"/>
          </lines>
          </method>
          <method name="getValue" signature="()I" line-rate="1.0" branch-rate="1.0">
          <lines>
          <line number="58" hits="2" branch="false"/>
          </lines>
          </method>
          <method name="setName" signature="(Ljava/lang/String;)V" line-rate="1.0"
          branch-rate="1.0">
          <lines>
          <line number="45" hits="2" branch="false"/>
          <line number="46" hits="2" branch="false"/>
          </lines>
          </method>
          <method name="setValue" signature="(I)V" line-rate="1.0" branch-rate="1.0">
          <lines>
          <line number="66" hits="1" branch="false"/>
          <line number="67" hits="1" branch="false"/>
          </lines>
          </method>
          </methods>
          <lines>
          <line number="23" hits="4" branch="false"/>
          <line number="25" hits="4" branch="false"/>
          <line number="37" hits="2" branch="false"/>
          <line number="45" hits="2" branch="false"/>
          <line number="46" hits="2" branch="false"/>
          <line number="58" hits="2" branch="false"/>
          <line number="66" hits="1" branch="false"/>
          <line number="67" hits="1" branch="false"/>
          </lines>
          </class>
          </classes>
          </package>
          </packages>
          </coverage>

          jiai jiai added a comment - Content of coverage.xml ======================= <?xml version="1.0"?> <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-03.dtd"> <coverage line-rate="0.5454545454545454" branch-rate="0.5" version="1.9" timestamp="1190550797680"> <sources> <source>src</source> </sources> <packages> <package name="de.jiai.demo" line-rate="0.4" branch-rate="0.5" complexity="0.0"> <classes> <class name="de.jiai.demo.Main" filename="de/jiai/demo/Main.java" line-rate="0.4" branch-rate="0.5" complexity="0.0"> <methods> <method name="<init>" signature="()V" line-rate="0.0" branch-rate="1.0"> <lines> <line number="25" hits="0" branch="false"/> <line number="27" hits="0" branch="false"/> </lines> </method> <method name="main" signature="([Ljava/lang/String;)V" line-rate="0.8333333333333334" branch-rate="1.0"> <lines> <line number="35" hits="1" branch="false"/> <line number="36" hits="1" branch="false"/> <line number="37" hits="1" branch="true" condition-coverage="100% (2/2)"> <conditions> <condition number="0" type="jump" coverage="100%"/> </conditions> </line> <line number="38" hits="52" branch="false"/> <line number="41" hits="1" branch="false"/> <line number="44" hits="1" branch="false"/> <line number="46" hits="1" branch="false"/> <line number="49" hits="1" branch="false"/> <line number="50" hits="0" branch="false"/> <line number="51" hits="0" branch="false"/> <line number="52" hits="1" branch="false"/> <line number="53" hits="1" branch="false"/> </lines> </method> <method name="main2" signature="([Ljava/lang/String;)V" line-rate="0.0" branch-rate="0.0"> <lines> <line number="61" hits="0" branch="false"/> <line number="62" hits="0" branch="false"/> <line number="63" hits="0" branch="true" condition-coverage="0% (0/2)"> <conditions> <condition number="0" type="jump" coverage="0%"/> </conditions> </line> <line number="64" hits="0" branch="false"/> <line number="68" hits="0" branch="false"/> <line number="70" hits="0" branch="false"/> <line number="73" hits="0" branch="false"/> <line number="74" hits="0" branch="false"/> <line number="75" hits="0" branch="false"/> <line number="76" hits="0" branch="false"/> <line number="78" hits="0" branch="false"/> </lines> </method> </methods> <lines> <line number="25" hits="0" branch="false"/> <line number="27" hits="0" branch="false"/> <line number="35" hits="1" branch="false"/> <line number="36" hits="1" branch="false"/> <line number="37" hits="1" branch="true" condition-coverage="100% (2/2)"> <conditions> <condition number="0" type="jump" coverage="100%"/> </conditions> </line> <line number="38" hits="52" branch="false"/> <line number="41" hits="1" branch="false"/> <line number="44" hits="1" branch="false"/> <line number="46" hits="1" branch="false"/> <line number="49" hits="1" branch="false"/> <line number="50" hits="0" branch="false"/> <line number="51" hits="0" branch="false"/> <line number="52" hits="1" branch="false"/> <line number="53" hits="1" branch="false"/> <line number="61" hits="0" branch="false"/> <line number="62" hits="0" branch="false"/> <line number="63" hits="0" branch="true" condition-coverage="0% (0/2)"> <conditions> <condition number="0" type="jump" coverage="0%"/> </conditions> </line> <line number="64" hits="0" branch="false"/> <line number="68" hits="0" branch="false"/> <line number="70" hits="0" branch="false"/> <line number="73" hits="0" branch="false"/> <line number="74" hits="0" branch="false"/> <line number="75" hits="0" branch="false"/> <line number="76" hits="0" branch="false"/> <line number="78" hits="0" branch="false"/> </lines> </class> </classes> </package> <package name="de.jiai.demo.beans" line-rate="1.0" branch-rate="1.0" complexity="1.0"> <classes> <class name="de.jiai.demo.beans.NewBean" filename="de/jiai/demo/beans/NewBean.java" line-rate="1.0" branch-rate="1.0" complexity="1.0"> <methods> <method name="<init>" signature="()V" line-rate="1.0" branch-rate="1.0"> <lines> <line number="23" hits="4" branch="false"/> <line number="25" hits="4" branch="false"/> </lines> </method> <method name="getName" signature="()Ljava/lang/String;" line-rate="1.0" branch-rate="1.0"> <lines> <line number="37" hits="2" branch="false"/> </lines> </method> <method name="getValue" signature="()I" line-rate="1.0" branch-rate="1.0"> <lines> <line number="58" hits="2" branch="false"/> </lines> </method> <method name="setName" signature="(Ljava/lang/String;)V" line-rate="1.0" branch-rate="1.0"> <lines> <line number="45" hits="2" branch="false"/> <line number="46" hits="2" branch="false"/> </lines> </method> <method name="setValue" signature="(I)V" line-rate="1.0" branch-rate="1.0"> <lines> <line number="66" hits="1" branch="false"/> <line number="67" hits="1" branch="false"/> </lines> </method> </methods> <lines> <line number="23" hits="4" branch="false"/> <line number="25" hits="4" branch="false"/> <line number="37" hits="2" branch="false"/> <line number="45" hits="2" branch="false"/> <line number="46" hits="2" branch="false"/> <line number="58" hits="2" branch="false"/> <line number="66" hits="1" branch="false"/> <line number="67" hits="1" branch="false"/> </lines> </class> </classes> </package> </packages> </coverage>

          Should be fixed by 0.8.1
          (but please reopen if it's not)

          stephenconnolly Stephen Connolly added a comment - Should be fixed by 0.8.1 (but please reopen if it's not)
          jiai jiai added a comment -

          Unfortunately it doesn't seems to be fixed. There is no difference to the last
          but one version. I've sent you my sample project, perhaps this might help?

          jiai jiai added a comment - Unfortunately it doesn't seems to be fixed. There is no difference to the last but one version. I've sent you my sample project, perhaps this might help?

          Should be fixed in 0.8.2 (I hope)

          stephenconnolly Stephen Connolly added a comment - Should be fixed in 0.8.2 (I hope)
          jiai jiai added a comment -

          Great - it works!

          jiai jiai added a comment - Great - it works!

          People

            stephenconnolly Stephen Connolly
            jiai jiai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: