Jacoco-sonar-code coverage

69 views
Skip to first unread message

Mallik Arjun

unread,
Mar 21, 2018, 2:17:57 AM3/21/18
to JaCoCo and EclEmma Users
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>

Evgeny Mandrikov

unread,
Mar 21, 2018, 5:07:00 AM3/21/18
to JaCoCo and EclEmma Users
First of all we are not developing SonarQube integration, so for questions about SonarQube you'd better seek help in its community - https://www.sonarqube.org/community/

Secondly here is some of the many answers on the same/similar question:

Mallik Arjun

unread,
Mar 22, 2018, 2:23:20 AM3/22/18
to JaCoCo and EclEmma Users
Iam sorry for asking this question in wrong community. I think my question was not clear.The above is not a multi module project . They are two separate projects. webapplication is in one project and test suite is in another project. the test suite is an xml file, where we declare all the packages for testing. In that case , can u help me?
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages