settings.xml 里加入
<profiles> <profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <!-- Sonar Host e.g. http://localhost:9000 --> <sonar.host.url> http://localhost:9000 </sonar.host.url> </properties> </profile> </profiles>
Exclusion files in pom.xml
<sonar.exclusions> /usr/file1 /usr/file2 </sonar.exclusions>
Run Sona using maven
mvn clean install sonar:sonar -s /maven/location/settings.xml