In this case you need to configure the JaCoCo agent for the tomcat instance -- depends on how you launch it. Here you find general information about the JaCoCo agent:

  http://www.eclemma.org/jacoco/trunk/doc/agent.html

Regards,
-marc

On 14.04.15 09:41, [email protected] wrote:
Hi Marc,
Thank you for the quick response.
I did go through the doc and have created a pom which works fine for me but 
only for the local tests and not the source files which I am running in a 
different instance of tomcat.Can i do code coverage of the source files from 
the pom of my tests?
Details of the pom
<plugin>
                                <groupId>org.jacoco</groupId>
                                <artifactId>jacoco-maven-plugin</artifactId>
                                <version>0.7.1.201405082137</version>
                                <configuration>
                                        <append>true</append>

                                        
<destFile>${project.build.directory}/coverage/jacoco.exec</destFile>
                                        
<dataFile>${project.build.directory}/coverage/jacoco.exec</dataFile>
                                        <!-- <tcpclient>127.0.0.1</tcpclient> 
<port>8080</port> -->

                                        
<outputDirectory>${project.build.directory}/coverage-reports/</outputDirectory>
                                        
<classDumpDir>${project.build.directory}/coverage-reports/</classDumpDir>
                                        <excludes />
                                        <skip>false</skip>
                                        <includes>
                                                <include>com/**</include>
                                        </includes>
                                        
<!--<propertyName>surefireArgLine</propertyName>-->
                                        
<propertyName>jacoco.agent.argLine</propertyName>
                                </configuration>
                                <executions><!-- Prepares the property pointing 
to the JaCoCo runtime
                                                agent which is passed as VM 
argument when Maven the Surefire plugin is executed. -->
                                        <execution>
                                                <id>default-prepare-agent</id>
                                                <goals>
                                                        
<goal>prepare-agent</goal>
                                                </goals>
                                        </execution>
                                        <execution>
                                                <id>default-report</id>
                                                <phase>prepare-package</phase>
                                                <goals>
                                                        <goal>report</goal>
                                                </goals>
                                        </execution>
                                        <execution>
                                                <id>default-check</id>
                                                <goals>
                                                        <goal>check</goal>
                                                </goals>
                                                <configuration>
                                                        <rules>
                                                                <rule>
                                                                        
<element>BUNDLE</element>
                                                                        <limits>
                                                                                
<limit>
                                                                                        
<counter>INSTRUCTION</counter>
                                                                                        
<value>COVEREDRATIO</value>
                                                                                        
<minimum>0.60</minimum>
                                                                                
</limit>
                                                                                <!-- <limit> 
<counter>LINE</counter> <value>COVEREDRATIO</value>
                                                                                        
<minimum>0.60</minimum> </limit> -->
                                                                                
<limit>
                                                                                        
<counter>BRANCH</counter>
                                                                                        
<value>COVEREDRATIO</value>
                                                                                        
<minimum>0.60</minimum>
                                                                                
</limit>
                                                                                
<limit>
                                                                                        
<counter>COMPLEXITY</counter>
                                                                                        
<value>COVEREDRATIO</value>
                                                                                        
<minimum>0.60</minimum>
                                                                                
</limit>
                                                                                
<limit>
                                                                                        
<counter>METHOD</counter>
                                                                                        
<value>COVEREDRATIO</value>
                                                                                        
<minimum>0.60</minimum>
                                                                                
</limit>
                                                                                
<limit>
                                                                                        
<counter>CLASS</counter>
                                                                                        
<value>MISSEDCOUNT</value>
                                                                                        
<maximum>0</maximum>
                                                                                
</limit>
                                                                        
</limits>

                                                                </rule>

                                                                <rule>
                                                                        
<element>CLASS</element>
                                                                        <!-- <excludes> 
<exclude>*Test</exclude> </excludes> -->
                                                                        <limits>
                                                                                
<limit>
                                                                                        
<counter>LINE</counter>
                                                                                        
<value>COVEREDRATIO</value>
                                                                                        
<minimum>0.50</minimum>
                                                                                
</limit>
                                                                        
</limits>
                                                                </rule>
                                                        </rules>
                                                        <!--  <target>
                                                                <report>
                                                                        
<executiondata>
                                                                                <fileset 
dir="${project.build.directory}">
                                                                                        
<include name="jacoco.exec" />
                                                                                
</fileset>
                                                                                
                                                                        
</executiondata>
                                                                </report>
                                                        </target> -->

                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
                                <version>2.16</version>
                                <configuration>
                                        
<argLine>${jacoco.agent.argLine}</argLine>
                                        <!-- <fork>true</fork> 
<forkmode>once</forkmode> -->

                                        <execution>
                                                <id>default-test</id>
                                                <phase>test</phase>
                                                <goals>
                                                        <goal>test</goal>
                                                </goals>
                                        </execution>


--
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/5534DC2B.3060908%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to