This project consists of a single module with Scala and Java sources.
It uses jacoco-maven-plugin, surefire-maven-plugin, scoverage-maven-plugin, scapegoat and sonar-maven-plugin and includes examples of how to configure and execute SonarQube analysis.
To run the analysis execute the following command setting the sonar.host.url property to point to your SonarQube instance with installed sonar-scala plugin.
mvn -Dsonar.host.url=http://localhost clean test scoverage:report jacoco:report scala:compile sonar:sonarNotes:
-
Sometimes, the Scapegoat report file (
scapegoat.xml) gets cleaned after the execution of the tests.
Running thescala:compiletarget will trigger the scapegoat analysis once again. Thus, refreshing the report file.
For that reason, it is recommended to alwasy excecute it just before running the sonar scanner. -
Even if, on most projects the
${project.build.directory}property equals./target.
It is recommended to use it instead, just to ensure both Scapegoat and sonar-scala use the same folder for writing / reading the report file.
To see the result of an example analysis of this project, please go to https://sonar.sonar-scala.com.
For more configuration options please refer to SonarQube Maven Scanner documentation.