1. Added Java agent with Jacocoagent.jar in tomcat.conf file under JAVA_OPTS
javaagent:/opt/jacoco/lib/jacocoagent.jar=destfile=/opt/jacoco/Result/jacoco.exec,classdumpdir=/opt/jacoco/Result/classes,append=false,includes=*
2. Started Tomcat.
3. Ran tests.
4. After tests are complete stoped the tomcat in order to generate the .exec file.
5. Keep class files which I wanted to instrument in one place along with the exec file.
6. Now ran the report generation command
java -jar Path/jacococli.jar report Path/jacoco.exec --classfiles Path/classes --html Path/Report --name jacocoReport --sourcefiles Path/src/main/java
Now I am able to generate HTML report. But not able to see the highlighted source code. But from the report I can see the functions under the classes.
For adding debugging info to the class I have added below code to maven's pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines</debuglevel>
</configuration>
</plugin>
Hi,
does your generated HTML report show a column called "Lines"? If not, the class files do not contain debug information.
Regards,
-marc
--
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 jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/9d440a15-f2d2-49c3-91b8-2af73b0d6700%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ok, this means your class files are compiled with debug information.
Did you double check that your source files are available at the location you provided?
--sourcefiles Path/src/main/java
Note that this path needs to point to the parent folder of the Java package hierarchy. E.g. if you have a class com.example.Foo the source file has to be in this folder:
Path/src/main/java/com/example/Foo.java
If this check is positive can you please share one of your class file?
Thanks,
-marc
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/cfeda9f4-d697-49c3-ad08-959bf1e78582%40googlegroups.com.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
</configuration>
-javaagent:/Users/sabyasachi/Documents/JacocoJars/jacocoagent.jar=output=file,destfile=/Users/sabyasachi/Documents/jacoco.exec,dumponexit=true,includes=*,classdumpdir=/Users/sabyasachi/Documents/cla,append=false
java -jar /Users/sabyasachi/Documents/JacocoJars/jacococli.jar report /Users/sabyasachi/Documents/jacoco.exec --classfiles /Users/sabyasachi/Documents/MathTest.class --html /Users/sabyasachi/Desktop/Rep1 --name jacocoReport --sourcefiles /Users/sabyasachi/Documents/MathTest.java
Hi Sabyasachi,
one problem is with your parameter
--sourcefiles /Users/sabyasachi/Documents/MathTest.java
Please specify a directory here, which is the root of your java package structure. See FAQ:
Make sure the following prerequisites are fulfilled to get source code highlighting in JaCoCo coverage reports:
Regards,
-marc
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/3fdac41d-b31c-48ad-b2ef-4a7899bb378d%40googlegroups.com.
As I said before: Your --sourcefiles parameter is wrong. Instead of
--sourcefiles /Users/sabyasachi/eclipse-workspace5/JACPOC/src/com/math/pkg/MathTest.java
specify
--sourcefiles /Users/sabyasachi/eclipse-workspace5/JACPOC/src/
It has to be the root folder of your Java package hierarchy. Anything else will simply not work.
Regards,
-marc
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/2828fc57-bd0a-4c14-8f47-aae0e57aaaf7%40googlegroups.com.