I have configured sonar in my web application which is a maven project. I 
have added the below code snippets to my pom.xml . It is covering code 
analysis for my project. For unit and integration tests, I have separate 
test suite in another module. The test module has my webapp module as a 
profile. If I run the test suite, my webapp's jacoco should get triggered 
and should perform code coverage and report it to sonar dynamically. How 
can I perform this functionality in my webapp. please help.

<sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>


<profile>
            <id>sonar-coverage</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!--<sonar.exclusions>**/*.java</sonar.exclusions>-->
            </properties>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.jacoco</groupId>
                            <artifactId>jacoco-maven-plugin</artifactId>
                            <version>0.7.8</version>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <configuration>
                            <append>true</append>
                        </configuration>
                        <executions>
                            <execution>
                                <id>agent-for-ut</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>agent-for-it</id>
                                <goals>
                                    <goal>prepare-agent-integration</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>jacoco-site</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

-- 
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/51462216-cd66-423b-b85f-b50d97644f4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to