jacoco for web application with ant and tomcat combination

21 views
Skip to first unread message

kranthide...@gmail.com

unread,
Sep 19, 2017, 1:53:33 PM9/19/17
to JaCoCo and EclEmma Users
Hi
I am new to jacoco and i have tried jacoco on a core java application with <jacoco:coverage> and it has worked fine. now i want to integrate jacoco on a web application which runs on tomcat. i saw that we have to add <jacoco:agent> for that below are my doubts
1. if we add <jacoco:agent> in build.xml is that sufficent ? or do i have to make changes for java_OPTS in tomcat ?
2. i tried in the below way and it did not work am i missing something ?
a. added <jacoco:agent> in build.xml and made changes for java_Opts in tomcat.
where do we get the result inde.html in this case.
do we have to do anything else other than this?

Marc Hoffmann

unread,
Sep 19, 2017, 3:38:14 PM9/19/17
to jac...@googlegroups.com
Hi,

you need to ensure that the Tomcat instance under test runs with the
JaCoCo agent. Documentation shows how to configure the agent:
http://www.jacoco.org/jacoco/trunk/doc/agent.html

Typically Tomcat comes with its own configuration files where you can do
this.

In case you want to dynamically configure the agent during your build
the jacoco:agent task simply helps you assemble the command line option.

After tomcat is properly terminated the agent writes a execution data
file (e.g. jacoco.exec). Using this file and the original class files a
report can be generated with the jacoco:report task.

The process and all Ant tasks are documented:
http://www.jacoco.org/jacoco/trunk/doc/ant.html

Regards,
-marc
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages