1

In Sonar, we just download the sonar setup and if need, change the db credentials and run the command on maven project sonar:sonar, our coding stats and bugs are are analyzed by sonar and make the good html reports. But for this we need to run sonar:sonar command. Like findbugs, its possible to integrate with maven and create reports and time of maven:install .In this LINK at 4th step explain. Is also possible with sonar for make the report on maven:install command?

Harmeet Singh Taara
  • 6,483
  • 20
  • 73
  • 126
  • Have you been able to do that? Run sonar during maven:install command? Did it have any side effects? Did you have this side effect by any chance? http://stackoverflow.com/questions/29099614/how-to-make-sonar-module-analyze-the-project-only-once-when-sonar-analysis-is-bo – Zhenya Mar 18 '15 at 08:07

1 Answers1

2

Like you can see on the SonarQube documentation, we strongly advise you to first run mvn clean install and then mvn sonar:sonar separately - otherwise you can have some side effects.

However, if you want to have all this in a single run, this is a Maven-related question. You just have to bind the "sonar" goal to the "install" phase in your POM, with something like:

...
<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>install</phase>
                    <goals>
                        <goal>sonar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
...
Zhenya
  • 6,020
  • 6
  • 34
  • 42