
use Advanced Reactor Options (such as "-pl"). use build profiles to exclude some modules (like for integration tests).
define property true in the pom.xml of the module you want to exclude. To help you get started, a simple project sample is available here: Excluding a module from analysis If you would like to override the default values of specific additional parameters, configure the parameter names found on the analysis parameters page in the section of your pom.xml like this: Most analysis properties will be read from your project. To get coverage information, you'll need to generate the coverage report before the analysis and specify the location of the resulting report in an analysis parameter. To specify the version of sonar-maven-plugin instead of using the latest: mvn :sonar-maven-plugin:3.:sonar Mvn sonar:sonar -Dsonar.token=myAuthenticationToken Be sure to use install as first step for multi-module projects mvn clean install In some situations you may want to run the sonar:sonar goal as a dedicated step. mvn clean verify sonar:sonar -Dsonar.token=myAuthenticationToken You need to pass an authentication token using the sonar.token property in your command line.
Global settingsĪnalyzing a Maven project consists of running a Maven goal: sonar:sonar from the directory that holds the main project pom.xml. At least the minimal version of Java supported by your SonarQube server is in useĮdit the settings.xml file, located in /conf or ~/.m2, to set the plugin prefix and optionally the SonarQube server URL.By preconfiguring the analysis based on that information, the need for manual configuration is reduced significantly. The Maven build already has much of the information needed for SonarQube to successfully analyze a project. The ability to execute the SonarQube analysis via a regular Maven goal makes it available anywhere Maven is available (developer build, CI server, etc.), without the need to manually download, set up, and maintain a SonarQube scanner installation. The SonarScanner for Maven is recommended as the default scanner for Maven projects.