Petteri H
Petteri H

Reputation: 12242

How to generate two sonar reports from the same project?

I would like to create two sets of Sonar reports from the same project. One would have everything covered and the other one would have some packages excluded.

Is this possible and if so, how to do such?

Edit: Setting exclusions is not a problem but having two reports is.

Upvotes: 4

Views: 8178

Answers (1)

Andrzej Jozwik
Andrzej Jozwik

Reputation: 14649

Create new profile in maven and add call sonar with new branch for each profile: mvn clean install -Pprofile1 sonar:sonar -Dsonar.branch=BRANCH1

   <properties>
       <sonar.branch>
          DEFAULT_BRANCH
        </sonar.branch>
    </properties>
 
    <profiles>
            <profile>
                <id>sonar</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <properties>
                    <sonar.host.url>
                      http://localhost:9000
                    </sonar.host.url>
                </properties>
            </profile>
            <profile>
                <id>profile1</id>                
                <properties>
                    <!-- Optional URL to server. Default value is http://localhost:9000 -->
                    <sonar.host.url>
                      http://myserver:9000
                    </sonar.host.url>
                </properties>
            </profile>
         </profiles>

Upvotes: 13

Related Questions