Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You must have previously installed and configured Maven for Sonar and SonarQubeTM and read Analyzing Code Source.

...

Analyzing a Maven project consists of running a Maven goal in the directory where the pom.xml file sits. If possible, an install goal should be performed prior to the sonar one:sonar one.

Recommended Way

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

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

...

Note
titleUsing Eclipse

Make sure you're not using the eclipse Eclipse plugin maven embedder. Define a new maven Maven runtime pointing to your local maven Maven install, use the latest maven eclipse plugin and uncheck "resolve workspace artifacts" in the maven project launch window.
Have a look at the first comment of this ticket: http://jira.codehaus.org/browse/SONAR-929

Note
titleAdvanced Reactor Options

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

Alternative Way

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 one. Do not use the DskipTests=true parameter, otherwise Sonar will not execute unit tests and therefore not report on them.

...