In SonarQube
, "Coverage on new code" considers java
and js
files for my java web applications. Is it possible to exclude js
files from it?
I'm using:
SonarQube-6.7.1
community edition. Jacoco
maven plugin for code-coverage on java codes. For jacoco maven plugin just add the configuration to exclude the files as below:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<extensions>true</extensions>
<configuration>
<excludes>
<exclude>org/yates/webapp/web/config/*.class</exclude>
</excludes>
</configuration>
</plugin>
For SonarQube You can set the sonar.exclusions
property
sonar.exclusions=src/main/java/org/sonar/*
Refer the documentation below: https://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreFiles
UPDATE:
For SONAR coverage exclusions:
<properties>
<sonar.coverage.exclusions>foo/**/*,**/bar/*</sonar.coverage.exclusions>
</properties>