Add the following to the pom.xml-file:
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.3.0.603</version>
</plugin>
...
</plugins>
<properties>
...
<sonar.host.url>http://<hostname>/sonar</sonar.host.url>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
...
</properties>
mvn clean install sonar:sonar
Requires SureFire to exists in the classpath/buildroutine. Example-configuration:
<?xml version="1.0" encoding="UTF-8"?>
<profiles>
<profile>
<id>default</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${plugin.surefire.version}</version>
<configuration>
<excludes>
<exclude>**/**/*IntTest.java</exclude>
<exclude>**/**/*CtxTest.java</exclude>
</excludes>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<activation>
<activeByDefault>true</activeByDefault>
</activation
</profile>
</profiles>