Hi,

I think the FAQ <http://www.jacoco.org/jacoco/trunk/doc/faq.html> has an answer for you:


         Why does the coverage report not show line coverage figures?

   JaCoCo is based on class files analysis. To calculate line coverage
   class files must contain line number attributes. For this your code
   must be compiled with debug information.

Documentation also includes an Ant example <http://www.jacoco.org/jacoco/trunk/doc/examples/build/build.xml> which shows how to properly configure the javac task for debug information.

Regards,
-marc



On 23.06.17 06:51, [email protected] wrote:
Okay so I had been compiling the .java files on command prompt via ant, it 
created the .class files and the report was generated which gave me the 
LINE_MISSED and LINE_COVERED as 0

Now, I compiled the classes in Eclipse itself and copied them to the point 
where ant starts creating the jar using the .class files.
Surprisingly, the file created now has the line numbers mentioned correctly.
Why is this happening?


<target name="compile">
    <mkdir dir="${classes.dir}"/>
    <javac srcdir="${src.dir}" destdir="${classes.dir}" 
includeantruntime="false">
        <classpath>
             <pathelement location="C:/JUnit/apache-ant-1.10.1/src"/>
            <path refid="classpath"/>
        </classpath>
        <compilerarg value="-Xlint"/>
        <compilerarg line="-Xmaxerrs 10000" />
    </javac>
</target>


<target name="jar">
     <mkdir dir="${jar.dir}"/>
     <jar destfile="${jar.dir}/${ant.project.name}.jar" 
basedir="${classes.dir}">
             <manifest>
                 <attribute name="Main-Class" value="${main-class}"/>
             </manifest>
      </jar>
</target>


--
You received this message because you are subscribed to the Google Groups "JaCoCo 
and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/bfcb2ec2-7ab1-ed2a-aa44-9671dca3c648%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to