Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: mostly wording tweaks, but please double-check me in the 'Using Eclipse' note, where I elaborated with "m2eclipse" and "m2e"


Code Block
mvn clean install -DskipTests=true
mvn sonar:sonar

Use skipTests=true to not to run unit tests twice: once during the install goal and again during the sonar:sonar goal. You can also deactivate the integration tests test execution. Please refer to the Maven documentation.


titleUsing Eclipse

Make sure you're not using the Eclipse plugin maven embedderMaven Embedder (m2eclipse). Define a new Maven runtime pointing to your local Maven install, use the latest maven eclipse plugin Maven Eclipse plugin, m2e, and uncheck "resolve workspace artifacts" in the maven Maven project launch window.
Have a look at the first comment of this ticket:

titleAdvanced Reactor Options

Note that Advanced Reactor Options (such as "--projects" and "--resume-from") are not supported by SonarQube and should not be used.




When the above configuration is not possible, you can run an analysis in one command, but unit tests will run twice: once in the install goal and once in the sonar:sonar one goal. Do not use the -DskipTests=true parameter, otherwise the unit tests will not be executed at all.

Code Block
mvn clean install sonar:sonar -Dmaven.test.failure.ignore=true

The -Dmaven.test.failure.ignore=true is there to make sure that even if some unit tests fail, the SonarQube analysis will be performed.

Configuring the SonarQubeAnalysisSonarQube Analysis

A pom.xml file sample is available here.


Sample Projects

To help you getting get started, a simple project sample is available on github that can be browsed or downloadedprojects/languages/java/maven/java-maven-simple